File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import wrapt
1111from webtest import TestApp
1212
13+
14+ # Temporary: output GitHub annotations for test failures so we can debug CI
15+ def pytest_runtest_makereport (item , call ):
16+ """Output GitHub Actions annotations for failed tests."""
17+ if call .when == "call" and call .excinfo is not None :
18+ import traceback
19+
20+ tb = "" .join (traceback .format_exception (call .excinfo .type , call .excinfo .value , call .excinfo .tb ))
21+ # GitHub annotations can't have newlines, encode them
22+ msg = tb .replace ("\n " , "%0A" ).replace ("\r " , "%0D" )
23+ fspath = str (item .fspath ) if hasattr (item , "fspath" ) else ""
24+ line = item .reportinfo ()[1 ] if item .reportinfo ()[1 ] else 0
25+ print (f"\n ::error file={ fspath } ,line={ line } ,title=Test Failure: { item .nodeid } ::{ msg } " )
26+ elif call .when == "setup" and call .excinfo is not None :
27+ import traceback
28+
29+ tb = "" .join (traceback .format_exception (call .excinfo .type , call .excinfo .value , call .excinfo .tb ))
30+ msg = tb .replace ("\n " , "%0A" ).replace ("\r " , "%0D" )
31+ print (f"\n ::error title=Setup Failure: { item .nodeid } ::{ msg } " )
32+
1333from scout_apm .core import error_service as scout_apm_core_error_service
1434from scout_apm .core .agent import socket as scout_apm_core_socket
1535from scout_apm .core .agent .manager import CoreAgentManager
You can’t perform that action at this time.
0 commit comments