Skip to content

test: clean up simulated-acquisition output instead of littering /tmp - #640

Open
Alpaca233 wants to merge 1 commit into
masterfrom
test/cleanup-simulated-acquisition-output
Open

test: clean up simulated-acquisition output instead of littering /tmp#640
Alpaca233 wants to merge 1 commit into
masterfrom
test/cleanup-simulated-acquisition-output

Conversation

@Alpaca233

Copy link
Copy Markdown
Collaborator

Problem

get_test_multi_point_controller and get_test_qt_multi_point_controller point simulated acquisitions at a literal "/tmp/". Every test that runs an acquisition leaves ~180 MB of simulated image data in /tmp/unit_test_experiment_* forever. Accumulated runs filled an entire 782 GB disk on a dev machine on 2026-09-05 (38 GB of test output going back days).

Fix

  • The stub factories create the acquisition base dir with tempfile.mkdtemp(prefix="squid_unit_test_acquisition_") and register it in test_stubs._acquisition_output_dirs.
  • cleanup_leaked_hardware (the existing autouse teardown fixture in tests/conftest.py) deletes the registered dirs at the end of each test — after controllers/microscopes are closed, so no writer is alive when the tree is removed. Peak disk usage is now one test's output instead of an unbounded accumulation.
  • The watchdog breadcrumb dir (squid-test-watchdog-cleanup-<pid>, written during leaked-acquisition cleanup, never read) is removed at session finish.

Testing

  • New tests/control/test_stub_acquisition_cleanup.py covers the registration and the cleanup.
  • Full suite (CI selection): 1791 passed, 9 skipped, 1 xfailed — and /tmp contains no unit_test_experiment_*, squid_unit_test_acquisition_*, or watchdog-cleanup leftovers afterwards (verified in the same shell).

🤖 Generated with Claude Code

The stub multipoint controllers pointed simulated acquisitions at a literal
"/tmp/", and each run left ~180 MB of image data there forever - accumulated
runs filled an entire disk on 2026-09-05.

The stub factories now write under a mkdtemp dir registered in test_stubs;
cleanup_leaked_hardware deletes the registered dirs at test teardown, after
every writer is closed, and the watchdog breadcrumb dir is removed at session
finish. A full suite run now leaves /tmp empty.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant