Skip to content

Commit 8cd49f7

Browse files
author
Benedikt Fuchs
committed
add longrepr from plugin tests
1 parent 4677480 commit 8cd49f7

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)