Skip to content

Remove each test's tmp_path after it finishes - #246

Open
MaxGhenis wants to merge 1 commit into
mainfrom
fix/bundle-test-tmp-cleanup
Open

Remove each test's tmp_path after it finishes#246
MaxGhenis wants to merge 1 commit into
mainfrom
fix/bundle-test-tmp-cleanup

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

What

Adds tests/conftest.py with a tmp_path override that deletes each test's temp directory after the test finishes.

Why

test_build_bundle_writes_merged_consumer_contract builds the real source-package suites under tmp_path, about 14 GB per run, and the CLI bundle tests add a few hundred MB each. pytest keeps the three newest pytest-N base directories and only prunes older ones when no other pytest session holds a lock on them. With many agent sessions running the suite concurrently, nothing ever gets pruned: this morning the macOS temp folder held 69 base directories totalling 190 GB, almost all from this one test.

Removing the per-test directory at teardown keeps the base temp directory bounded no matter how many sessions are active.

Verification

Full suite on this branch with --basetemp pointed at a fresh directory:

853 passed, 1 skipped, 14 warnings in 1607.12s

The base temp directory held 12 KB afterwards.

🤖 Generated with Claude Code

The merged-bundle test builds real source suites under tmp_path, about
14 GB per run, and the CLI bundle tests add a few hundred MB each. pytest
keeps the three newest base temp directories and only prunes older ones
when no other session holds a lock, so with many pytest sessions running
at once the outputs pile up: 69 base directories totalling 190 GB were
sitting in the macOS temp folder today.

Override tmp_path in tests/conftest.py to delete the per-test directory
once the test completes, keeping the base temp directory bounded no
matter how many sessions are active.

Co-Authored-By: Claude Fable 5.1 <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