You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wanting to support a workflow that auto-persists on panic which is still not resolved and this issue is focused on.
There are trade offs though. If someone is unaware, it could really eat up their disk space, for example.
Original title: TempDir::persist_if(false) should make sure that TempDir is not persisted.
Original body:
Currently, persist_if(false) returns immediately, assuming that the TempDir was not persistent to begin with and that nothing needs to be done. This doesn't work if persist_if(true) had been called earlier.
I'd expect an API that takes a bool to allow switching between two states, but this one can only switch from false to true.
Use-case: I'd like to automatically persist files for failed tests only, so that I can debug failures without bloating my disk. A simple way to do this would be to persist_if(true) at the start and persist_if(false) after asserts have passed:
Maintainer Edit: There are two problems that we became aware of in this issue
There are trade offs though. If someone is unaware, it could really eat up their disk space, for example.
Original title:
TempDir::persist_if(false)should make sure thatTempDiris not persisted.Original body:
Currently,
persist_if(false)returns immediately, assuming that theTempDirwas not persistent to begin with and that nothing needs to be done. This doesn't work ifpersist_if(true)had been called earlier.I'd expect an API that takes a bool to allow switching between two states, but this one can only switch from false to true.
Use-case: I'd like to automatically persist files for failed tests only, so that I can debug failures without bloating my disk. A simple way to do this would be to
persist_if(true)at the start andpersist_if(false)after asserts have passed: