Skip to content

Test fixtures are not cleaned up after a test run and may be stale on subsequent runs #390

@inferiorhumanorgans

Description

@inferiorhumanorgans

Per #382 the default behavior with test fixtures is:

  • to only regenerate them when the contents of the fixture script changes
  • to not remove the fixtures after a test success

Potentially more desirable behavior is:

  • automatically remove the generated fixture after a test completes
  • a tunable (env var) to allow archiving the fixture before removal
  • or always archive before removal

I'm thinking the default behavior should be to leverage TempDir with a check at the end to see if an environment variable is set. If the variable is set, archive the fixture directory before the TempDir object goes out of scope.

Alternatively the existing logic (hashing the contents of the fixture script and placing the output in a directory within the repo) could be retained.

With either implementation the question is whether it's more desirable to move towards putting the test logic into closures (for more automatic cleanup) or to add an explicit check at the end of each test.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions