Files
bambuddy/backend/tests
maziggy 22f222e4ac fix(test): snapshot _timelapse_baselines inside the patch context to dodge CI race
test_running_observed_captures_baseline_on_restart_recovery was reading
  _timelapse_baselines.get(1) after the patch() with-block exited.
  Locally and under low parallelism this works fine — the dict still
  holds what _capture_timelapse_baseline_at_start wrote. CI under
  xdist's default load-balancing scheduling intermittently saw the
  dict empty by the time the top-level assert ran, even though the
  production code logged "Baseline at print start: 3 video files for
  printer 1" right before returning. The duplicate log line at the
  same microsecond in the captured stderr is the tell — module state
  is being re-touched between the handler completing and the test
  asserting, almost certainly via the session-scoped event_loop
  fixture in conftest.py interacting badly with the per-file
  autouse _clear_baselines teardown of a sibling test on the same
  worker.

  The test is verifying the handler captured the baseline at the
  moment it returned, so capture the relevant value at exactly
  that point — inside the with-block, immediately after the await.
  That's immune to whatever happens to the module-level dict
  afterward.
2026-05-24 12:30:12 +02:00
..