test: add auto-cleanup wrapper for repo fixtures #330
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestlane:foundationSupporting lane — core hardening, contracts, integritySupporting lane — core hardening, contracts, integritytestingTesting improvements and infrastructureTesting improvements and infrastructure
Description
Summary
Add a small withRepoFixture or usingRepoFixture helper that builds a fixture, passes it to a callback, and always calls cleanup() in a finally block.
The current fixture handle exposes explicit cleanup and cleans failed builds. That is correct, but test authors still need to remember try/finally for successful builds.
Why
Canonical fixture usage should be hard to leak. As more suites migrate under #316, an auto-cleanup wrapper will keep tests concise and reduce temp-directory leaks in failure cases.
Scope
- Add a wrapper helper for callback-style fixture usage.
- Preserve direct
build()access for tests that need manual lifetime control. - Add regression tests proving cleanup runs when the callback throws.
- Document the recommended pattern in the repo fixture strategy.
Acceptance Criteria
- Tests can use a single helper call to build and clean a fixture.
- Cleanup runs on callback success and failure.
- Existing explicit cleanup behavior remains available.
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestlane:foundationSupporting lane — core hardening, contracts, integritySupporting lane — core hardening, contracts, integritytestingTesting improvements and infrastructureTesting improvements and infrastructure
Activity