is_testing {testthat} | R Documentation |
Determine testing status
Description
These functions help you determine if you code is running in a particular testing context:
-
is_testing()
isTRUE
inside a test. -
is_snapshot()
isTRUE
inside a snapshot test -
is_checking()
isTRUE
inside ofR CMD check
(i.e. bytest_check()
). -
is_parallel()
isTRUE
if 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.
Usage
is_testing()
is_parallel()
is_checking()
is_snapshot()
testing_package()
[Package testthat version 3.2.1.1 Index]