teardown {testthat} | R Documentation |
Code in a setup()
block is run immediately in a clean environment.
Code in a teardown()
block is run upon completion of a test file,
even if it exits with an error. Multiple calls to teardown()
will be
executed in the order they were created.
teardown(code, env = parent.frame()) setup(code, env = parent.frame())
code |
Code to evaluate |
env |
Environment in which code will be evaluted. For expert use only. |
## Not run: tmp <- tempfile() setup(writeLines(tmp, "some test data")) teardown(unlink(tmp)) ## End(Not run)