Skip to content

Commit

Permalink
add testthat setup file to clean up after running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
japhir committed Jun 20, 2023
1 parent 5c1296c commit 620ce31
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cleanup <- function() {
cachedir <- tools::R_user_dir("snvecR", which = "cache")
if (dir.exists(cachedir)) {
cli::cli_inform("Removing {.file {cachedir}} from reproducible environment.")
unlink(cachedir, recursive = TRUE)
}
}

withr::defer(cleanup(), teardown_env())

0 comments on commit 620ce31

Please sign in to comment.