Skip to content

Support disabling cleanup for @TempDir #2159

Closed
@solter

Description

@solter

When initially developing tests against legacy code that utilizes the filesystem extensively, I often find myself creating using @TempDir, which is fantastic. But oftentimes when debugging and/or initially writing the test I need to capture the outputs to get a "golden file" that I can regression test against on future runs. As such, currently I just use a non-TempDir folder to capture them, then need to update my test using TempDir later.

It would be super helpful if instead the TempDir annotation provided an option so that I could disable cleanup for a couple of runs then re-enable cleanup later in the development lifecycle. I'm envisioning something like the following

@TempDir(cleanup=false)
private Path outputFolder;

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions