context() is deprecated, what helps finding context is the test file name that should correspond to the script name.
the helper function could be defined in a file tests/testthat/helper-
defining objects outside of test_that() makes it harder to run each test on its own, so it's better to do it inside test_that() (or in a helper function called from test_that()) even if it leads to a bit of repetition.
For instance in https://github.com/ropensci/popler/blob/master/tests/testthat/test-cov_unpack.R
context()
is deprecated, what helps finding context is the test file name that should correspond to the script name.tests/testthat/helper-
test_that()
makes it harder to run each test on its own, so it's better to do it insidetest_that()
(or in a helper function called fromtest_that()
) even if it leads to a bit of repetition.I recommend reading https://r-pkgs.org/testing-basics.html and the other chapters of that section.