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

Documentation error and issue with cleaning up files after testing #2045

Open
mattwarkentin opened this issue Jan 7, 2025 · 0 comments
Open

Comments

@mattwarkentin
Copy link

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:

```{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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant