qualR
qualR copied to clipboard
use withr::local_tempdir() instead of tempdir()?
trafficstars
Instead of https://github.com/ropensci/qualR/blob/95141311e88ad890dd06ad34069f637ae26b834e/tests/testthat/test-cetesb_retrieve_param.R#L5 you could use withr::local_tempdir() (withr would be listed under Suggests in DESCRIPTION) which would have the nice property of being cleaned up after automatically, the directory would be removed automatically after running the test. It also creates the file.
References
- https://withr.r-lib.org/reference/with_tempfile.html
- https://testthat.r-lib.org/articles/test-fixtures.html
- usage in packages on CRAN https://github.com/search?q=withr%3A%3Alocal_tempdir%28%29+user%3Acran+path%3Atests%2Ftestthat&type=Code&ref=advsearch&l=&l=