Skip to content

test: add auto-cleanup wrapper for repo fixtures #330

Description

@flyingrobots

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlane:foundationSupporting lane — core hardening, contracts, integritytestingTesting improvements and infrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions