From ea9500f70593e3043280ffb192934e0f28c659ad Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 4 Sep 2026 10:44:37 -0400 Subject: [PATCH] Remove each test's tmp_path after it finishes 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 --- tests/conftest.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..75fca18e --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,23 @@ +"""Shared pytest configuration for Chronicle tests.""" + +from __future__ import annotations + +import shutil + +import pytest + + +@pytest.fixture +def tmp_path(tmp_path): + """Remove everything a test wrote under ``tmp_path`` once it finishes. + + Several tests build real source-package suites and merged bundles under + ``tmp_path``; the merged consumer bundle alone writes about 14 GB of nested + suites. pytest keeps the three newest ``pytest-N`` base directories and only + prunes older ones when no other pytest session holds a lock on them, so with + many sessions running concurrently the outputs accumulate for days. Deleting + the per-test directory here keeps the base temp directory bounded regardless + of how many sessions are active. + """ + yield tmp_path + shutil.rmtree(tmp_path, ignore_errors=True)