These functions help you determine if you code is running in a particular testing context:
is_testing()isTRUEinside a test.is_snapshot()isTRUEinside a snapshot testis_checking()isTRUEinside ofR CMD check(i.e. bytest_check()).is_parallel()isTRUEif the tests are run in parallel.testing_package()gives name of the package being tested.
A common use of these functions is to compute a default value for a quiet
argument with is_testing() && !is_snapshot(). In this case, you'll
want to avoid an run-time dependency on testthat, in which case you should
just copy the implementation of these functions into a utils.R or similar.
