File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/pytest_plugins/filler Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -432,9 +432,28 @@ def pytest_terminal_summary(
432432 Emphasize that fixtures have only been filled; they must now be executed to
433433 actually run the tests.
434434 """
435- yield
436435 if config .fixture_output .is_stdout or hasattr (config , "workerinput" ): # type: ignore[attr-defined]
436+ yield
437437 return
438+ # if no tests were collected, suppress the "Generated html report" message;
439+ # the html report will be deleted in pytest_sessionfinish hook
440+ session = terminalreporter ._session
441+ if getattr (session , "testscollected" , 0 ) == 0 :
442+ orig_write_sep = terminalreporter .write_sep
443+
444+ def filtered_write_sep (sep , msg , ** kwargs ):
445+ if isinstance (msg , str ) and "Generated html report:" in msg :
446+ return # swallow it
447+ return orig_write_sep (sep , msg , ** kwargs )
448+
449+ terminalreporter .write_sep = filtered_write_sep # type: ignore
450+ try :
451+ yield # let all other terminal_summary hooks run
452+ finally :
453+ terminalreporter .write_sep = orig_write_sep # type: ignore
454+ else :
455+ # if tests ran, no action needed, just yield to run the rest of the hooks
456+ yield
438457 stats = terminalreporter .stats
439458 if "passed" in stats and stats ["passed" ]:
440459 # Custom message for Phase 1 (pre-allocation group generation)
You can’t perform that action at this time.
0 commit comments