Skip to content

Commit d8b44a0

Browse files
authored
Merge pull request #50 from helpmefindaname/main
add longrepr from plugin tests
2 parents 1324570 + 634200b commit d8b44a0

File tree

1 file changed

+6
-4
lines changed
  • pytest_github_actions_annotate_failures

1 file changed

+6
-4
lines changed

pytest_github_actions_annotate_failures/plugin.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ def pytest_runtest_makereport(item, call):
5757
longrepr = report.head_line or item.name
5858

5959
# get the error message and line number from the actual error
60-
try:
60+
if hasattr(report.longrepr, "reprcrash"):
6161
longrepr += "\n\n" + report.longrepr.reprcrash.message
6262
lineno = report.longrepr.reprcrash.lineno
63-
64-
except AttributeError:
65-
pass
63+
elif isinstance(report.longrepr, tuple):
64+
_, lineno, message = report.longrepr
65+
longrepr += "\n\n" + message
66+
elif isinstance(report.longrepr, str):
67+
longrepr += "\n\n" + report.longrepr
6668

6769
print(
6870
_error_workflow_command(filesystempath, lineno, longrepr), file=sys.stderr

0 commit comments

Comments
 (0)