@@ -1802,9 +1802,22 @@ def pytest_sessionfinish(session):
1802
1802
def pytest_terminal_summary (terminalreporter ):
1803
1803
if "--co" in sys_argv or "--collect-only" in sys_argv :
1804
1804
return
1805
- if not sb_config .item_count > 0 :
1805
+ if (
1806
+ not hasattr (terminalreporter , "stats" )
1807
+ or not hasattr (terminalreporter .stats , "keys" )
1808
+ ):
1809
+ return
1810
+ if len (terminalreporter .stats .keys ()) == 0 :
1811
+ return
1812
+ if not sb_config ._multithreaded and not sb_config ._sbase_detected :
1806
1813
return
1807
1814
latest_logs_dir = os .path .join (os .getcwd (), "latest_logs" ) + os .sep
1815
+ if (
1816
+ "failed" in terminalreporter .stats .keys ()
1817
+ and os .path .exists (latest_logs_dir )
1818
+ and os .listdir (latest_logs_dir )
1819
+ ):
1820
+ sb_config ._has_exception = True
1808
1821
if sb_config ._multithreaded :
1809
1822
if os .path .exists (latest_logs_dir ) and os .listdir (latest_logs_dir ):
1810
1823
sb_config ._has_exception = True
@@ -1814,7 +1827,7 @@ def pytest_terminal_summary(terminalreporter):
1814
1827
dash_lock_path = os .path .join (abs_path , dash_lock )
1815
1828
if os .path .exists (dash_lock_path ):
1816
1829
sb_config ._only_unittest = False
1817
- if ( sb_config ._has_exception or sb_config . _multithreaded ) and (
1830
+ if sb_config ._has_exception and (
1818
1831
sb_config .dashboard and not sb_config ._only_unittest
1819
1832
):
1820
1833
# Print link a second time because the first one may be off-screen
@@ -2114,6 +2127,7 @@ def pytest_runtest_makereport(item, call):
2114
2127
):
2115
2128
# Handle a bug on Python 3.11 where exceptions aren't seen
2116
2129
log_path = ""
2130
+ sb_config ._has_logs = True
2117
2131
if hasattr (sb_config , "_test_logpath" ):
2118
2132
log_path = sb_config ._test_logpath
2119
2133
if sb_config .dashboard :
0 commit comments