You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Auto-cleanup test containers on failure with --keep-containers flag #18
# Normal run - auto-cleanup on success AND failure
make test-integration
# Debug mode - keep containers for investigation
uv run pytest tests/test_integration.py --keep-containers -x
# Inspect the failed container
podman exec -it <container_name> bash
# Clean up manually when done
make clean-test-containers
Benefits
Containers cleaned up reliably even on failures
--keep-containers flag for debugging
Works with -x (stop on first failure) for debugging
Triage: Recommend closing as resolved by other means
@c-vigo — the original problem (lingering containers accumulating and breaking subsequent test runs) has been addressed by three layers of protection added since this issue was filed:
atexit.register(cleanup) on test_container and initialized_workspace fixtures — runs on process exit even on unhandled exceptions.
just _test-cleanup-check — the just test recipe automatically removes lingering containers before every test invocation.
pytest_sessionstart pre-flight check — detects lingering containers at session start and either auto-cleans (PYTEST_AUTO_CLEANUP=1) or fails fast with cleanup instructions.
The two remaining asks from this issue:
--keep-containers flag — nice-to-have, but pytest --pdb or breakpoint() are adequate alternatives for inspecting failed containers.
request.addfinalizer() migration — marginal reliability gain over yield. The edge case it covers (teardown skipped on fixture setup failure) is already caught by the pre-flight cleanup on the next run.
Neither item addresses a currently broken behavior. OK to close this?
Activity
gerchowl commentedon Feb 18, 2026
Triage: Recommend closing as resolved by other means
@c-vigo — the original problem (lingering containers accumulating and breaking subsequent test runs) has been addressed by three layers of protection added since this issue was filed:
atexit.register(cleanup)ontest_containerandinitialized_workspacefixtures — runs on process exit even on unhandled exceptions.just _test-cleanup-check— thejust testrecipe automatically removes lingering containers before every test invocation.pytest_sessionstartpre-flight check — detects lingering containers at session start and either auto-cleans (PYTEST_AUTO_CLEANUP=1) or fails fast with cleanup instructions.The two remaining asks from this issue:
--keep-containersflag — nice-to-have, butpytest --pdborbreakpoint()are adequate alternatives for inspecting failed containers.request.addfinalizer()migration — marginal reliability gain overyield. The edge case it covers (teardown skipped on fixture setup failure) is already caught by the pre-flight cleanup on the next run.Neither item addresses a currently broken behavior. OK to close this?
c-vigo commentedon Feb 19, 2026
Absolutely
test: add case for inline ## markers truncating changelog extraction