Description
Cargo provides a temp directory for integration tests via CARGO_TARGET_TMPDIR
. It's unfortunately not currently set for unit tests but it might still be nice to use it when it's available (I am only using testdir with integration tests, and I imagine that's somewhat typical). rust-lang/cargo#9375 has some context behind the motivation for this variable and why it's only set for integration tests.
FWIW I went looking for this setting because I was a little surprised testdir creates all its directories right in the target/
root; it ends up creating nine entries that seem like they could be nested under a common parent directory to keep the root dir cleaner. So in addition to / instead of using CARGO_TARGET_TMPDIR
it might be nice to put all these paths under a single common directory such as target/testdir/dir-*
.