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

cleanup tests/testthat/_snaps if there are no snapshots #1180

Closed
jimhester opened this issue Sep 15, 2020 · 4 comments
Closed

cleanup tests/testthat/_snaps if there are no snapshots #1180

jimhester opened this issue Sep 15, 2020 · 4 comments
Labels
bug an unexpected problem or unintended behavior snapshot 📷

Comments

@jimhester
Copy link
Member

jimhester commented Sep 15, 2020

The devel version seems to be leaving an empty _snaps folder if there are no snapshots. This is exposed during package build, so it would be nice to avoid if possible.

e.g.

* checking for empty or unneeded directories
Removed empty directory ‘usethis/tests/testthat/_snaps’
@hadley hadley added bug an unexpected problem or unintended behavior snapshot 📷 labels Dec 1, 2020
@hadley hadley closed this as completed in 20ae615 Dec 2, 2020
@ashirazist
Copy link

Is there a way to keep the _snaps folder even if there are no snapshots? I have saved some .Rdata in that directory and plan to use them in test files. The reason is that those are simulated data, and takes so long if running in test scripts.

@hadley
Copy link
Member

hadley commented Mar 22, 2021

@ashirazist the _snaps directory is "owned" by testthat. You should not put your own data there.

@ashirazist
Copy link

@hadley Thanks for reminding that. I know that, but I cannot figure out a place to put the data that's used in test files. Do you suggest anything?

@gaborcsardi
Copy link
Member

You can put it anywhere else in tests/testthat. Best not to start the directory and file names with an underscore. I like to put them in fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior snapshot 📷
Projects
None yet
Development

No branches or pull requests

4 participants