Private
Public Access
0
0
Files
manual_slop/tests
ed b0fefb2aab fix(tests): use pytest_terminal_summary as primary 'session done' signal
The previous smart watchdog (44b0b5d4, 91b19c90) used pytest_unconfigure as its signal. But pytest_unconfigure fires AFTER all fixtures, terminal summary, and finalizers — at the very end of the session. If anything in conftest's chain (e.g., the io_pool created in AppController.__init__ at conftest line ~65) hangs in __del__, pytest_unconfigure never gets called. Result: every batch's watchdog waited the full 60s/90s and then fired.

The right signal is pytest_terminal_summary, which fires AFTER the test summary is printed (the user can see '241 passed, 1 skipped in 32.30s' in the output) but BEFORE the shutdown hangs begin. At that point the test session is logically done; the watchdog can give a short 5s grace for normal finalization, then os._exit(0) so the runner can move to the next batch.

The previous attempts and why they failed (documented in test_conftest_smart_watchdog.py docstring):
  - e1c8730f: 30s os._exit(0) cut off batches mid-test
  - 719c5e27: os._exit(2) but daemon thread fired on every batch
  - 91b19c90: kept exit 2 but pytest_unconfigure never fires when io_pool hangs
  - 44b0b5d4: pytest_unconfigure as signal still hung
  - 2026-06-07 final: pytest_terminal_summary fires after summary print, before shutdown hangs

New contract:
  - Normal batch: pytest_terminal_summary fires at ~32s (after summary
    is printed), 5s grace, os._exit(0). Total: 37s.
  - Hung in test execution: pytest_terminal_summary never fires,
    smart watchdog waits 300s, fires os._exit(2).
  - Hung in conftest load (before any test): unconditional watchdog
    fires os._exit(2) at 60s.

7 tests in test_conftest_smart_watchdog.py updated to match:
  - test_terminal_summary_hook_sets_finished_event: primary signal source
  - test_unconfigure_hook_is_fallback_signal: fallback for crashes
  - test_clean_exit_uses_zero_exit_code: os._exit(0) after signal
  - test_hang_uses_nonzero_exit_code: os._exit(2) for true hangs
2026-06-07 13:37:09 -04:00
..
2026-03-05 17:13:59 -05:00
2026-05-10 15:14:54 -04:00
2026-05-20 07:51:58 -04:00
2026-03-05 16:37:30 -05:00
2026-03-05 17:13:59 -05:00
2026-03-05 16:37:30 -05:00
2026-03-07 20:32:59 -05:00
2026-03-06 22:03:59 -05:00
2026-03-05 17:13:59 -05:00
2026-03-12 19:08:51 -04:00
2026-03-05 15:10:53 -05:00
2026-03-12 19:08:51 -04:00
2026-03-12 19:08:51 -04:00
2026-05-20 07:51:58 -04:00
2026-05-20 07:51:58 -04:00
ok
2026-03-07 21:40:40 -05:00