Skip to content

Commit 9335efa

Browse files
authored
Dev to prd (#73)
2 parents ebf643f + ac16e06 commit 9335efa

3 files changed

Lines changed: 64 additions & 42 deletions

File tree

PyBugReporter/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.10'
1+
__version__ = '1.0.10b0.dev2'

PyBugReporter/src/BugReporter.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,17 @@ async def _getRepoId_async(self, handler: BugHandler) -> str:
366366
def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> None:
367367
"""Manually sends a bug report to the Github repository.
368368
369+
Args:
370+
repoName (str): the name of the repo to report to
371+
errorTitle (str): the title of the error
372+
errorMessage (str): the error message
373+
"""
374+
asyncio.run(cls.manualBugReportAsync(repoName,errorTitle,errorMessage))
375+
376+
@classmethod
377+
async def manualBugReportAsync(cls, repoName: str, errorTitle: str, errorMessage: str) -> None:
378+
"""Manually sends a bug report to the Github repository.
379+
369380
Args:
370381
repoName (str): the name of the repo to report to
371382
errorTitle (str): the title of the error
@@ -381,7 +392,7 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N
381392
headers = {"Authorization": f"Bearer {handler.githubKey}"}
382393

383394
# query variables
384-
repoId = cls._getRepoId(cls, handler)
395+
repoId = await cls._getRepoId_async(cls, handler)
385396
bugLabel = "LA_kwDOJ3JPj88AAAABU1q15w"
386397
autoLabel = "LA_kwDOJ3JPj88AAAABU1q2DA"
387398

@@ -414,10 +425,15 @@ def manualBugReport(cls, repoName: str, errorTitle: str, errorMessage: str) -> N
414425
}
415426
}
416427

417-
issueExists = cls._checkIfIssueExists(cls, handler, errorTitle)
428+
issueExists = await cls._checkIfIssueExists_async(cls, handler, errorTitle)
429+
430+
# Send to Discord if applicable
431+
if cls.handlers[repoName].useDiscord:
432+
discordBot = DiscordBot(cls.handlers[repoName].botToken, cls.handlers[repoName].channelId)
433+
await discordBot.send_message(f"## {repoName}: {errorTitle}\n{errorMessage}", issueExists)
418434

419435
if (issueExists == False):
420-
result = asyncio.run(client.execute_async(query=createIssue, variables=variables, headers=headers))
436+
result = await client.execute_async(query=createIssue, variables=variables, headers=headers)
421437
print('\nThis error has been reported to the Tree Growth team.\n')
422438
else:
423439
print('\nOur team is already aware of this issue.\n')

test.py

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
BugReporter.setVars(token, 'PyBugReporter', 'byuawsfhtl', False, True, discordToken, channelId)
1818

19+
BugReporter.manualBugReport("PyBugReporter",
20+
"Testing manual bug report",
21+
"This is a test of the manual bug report functionality")
22+
1923
@BugReporter('PyBugReporter', extraInfo=True, env='test')
2024
def test(item, item2=None):
2125
# raise Exception("""
@@ -53,43 +57,45 @@ def test(item, item2=None):
5357
# really really really really really really really really long test exception
5458
# """)
5559

56-
def this():
57-
def exception():
58-
def has():
59-
def an():
60-
def insane():
61-
def traceback():
62-
def length():
63-
def that():
64-
def just():
65-
def keeps():
66-
def going():
67-
def on():
68-
def yep():
69-
def still():
70-
def more():
71-
def never():
72-
def do():
73-
def this():
74-
raise Exception("This is a test exception")
75-
this()
76-
do()
77-
never()
78-
more()
79-
still()
80-
yep()
81-
on()
82-
going()
83-
keeps()
84-
just()
85-
that()
86-
length()
87-
traceback()
88-
insane()
89-
an()
90-
has()
91-
exception()
92-
this()
60+
# def this():
61+
# def exception():
62+
# def has():
63+
# def an():
64+
# def insane():
65+
# def traceback():
66+
# def length():
67+
# def that():
68+
# def just():
69+
# def keeps():
70+
# def going():
71+
# def on():
72+
# def yep():
73+
# def still():
74+
# def more():
75+
# def never():
76+
# def do():
77+
# def this():
78+
# raise Exception("This is a test exception")
79+
# this()
80+
# do()
81+
# never()
82+
# more()
83+
# still()
84+
# yep()
85+
# on()
86+
# going()
87+
# keeps()
88+
# just()
89+
# that()
90+
# length()
91+
# traceback()
92+
# insane()
93+
# an()
94+
# has()
95+
# exception()
96+
# this()
97+
98+
raise Exception("This is a test exception")
9399

94100

95-
test(None, item2='item2')
101+
# test(None, item2='item2')

0 commit comments

Comments
 (0)