Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running in Tempdir, cleaning up generated files? #126

Closed
matthiasbeyer opened this issue Jul 23, 2021 · 1 comment
Closed

Running in Tempdir, cleaning up generated files? #126

matthiasbeyer opened this issue Jul 23, 2021 · 1 comment

Comments

@matthiasbeyer
Copy link

Hi,

is there a possibility to run my tested binary in a tempdir and also cleaning that up after a successful (or even after a failing) test?

My binary creates files, I would thus also need a way to check whether files where generated with the appropriate contents, and clean them up after the tests.

If there is no such feature, feel free to consider this a feature-request! 😆

@epage
Copy link
Contributor

epage commented Jul 23, 2021

We've not baked in running in a tempdir but leave the file system operations to https://github.com/assert-rs/assert_fs, with the assumption people will most likely want to additional things, like setup some files before running the command or verify the files after.

For a simple example (though without assert_cmd), see https://github.com/sunng87/cargo-release/blob/b5db1c3c2686f2dcb91c2bf3f303b9f6e99f5945/src/cargo.rs#L236

@epage epage closed this as completed Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants