Closed
Description
These should be cleaned up, so it would be nice to support them "natively". E.g. something like:
tmpf <- test_temp_file()
tmpd <- test_temp_dir(cleanup = "block")
cleanup
can be block
or file
or testsuite
, to specify when to clean up the files.
withr::local_tempfile()
is almost good, and testthat could use it internally, but it is annoying that it fails if you copy and paste a test case to the console:
❯ withr::local_tempfile("foobar")
Error in defer(unlink(mget(new, envir = envir)), envir = envir) :
attempt to defer event on global environment
The testthat function could just ignore these calls.
Happy to do a PR.
Metadata
Metadata
Assignees
Labels
No labels