-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Labels
Description
Hi,
I think there is an issue with the documentation shown here: https://testthat.r-lib.org/articles/test-fixtures.html#package
Source code here:
testthat/vignettes/test-fixtures.Rmd
Lines 317 to 323 in 24ff6c0
| ```{r, eval = FALSE} | |
| # Run before any test | |
| write.csv("mtcars.csv", mtcars) | |
| # Run after all tests | |
| withr::defer(unlink("mtcars.csv"), teardown_env()) | |
| ``` |
The arguments are backwards for write.csv(). Moreover, I don't know that the suggested pattern works anyway for cleaning up files. At least I am unable to reproduce the desired behaviour. See the post here for a more complete real-world example: https://forum.posit.co/t/cleaning-up-temporary-files-after-testing-not-working-as-expected/196516