This is run automatically by test_that() but you may want to run it yourself if you want to replicate test results interactively. If run inside a function, the effects are automatically reversed when the function exits; if running in the global environment, use withr::deferred_run() to undo.

It sets the following options with withr::local_options():

• cli.unicode = FALSE so that the cli package never generates unicode output (normally cli uses unicode on Linux/Mac but not Windows).

• crayon.enabled = FALSE suppresses ANSI colours generated by the crayon package (normally colours are used if crayon detects that you're in a terminal that supports colour).

• lifecycle_verbosity = "warning" so that every lifecycle problem always generates a warning (otherwise deprecated functions don't generate a warning every time).

• OutDec = "." so numbers always uses . as the decimal point (European users sometimes set OutDec = ",".)

• rlang_interactive = FALSE so that rlang::is_interactive() returns FALSE, and code that uses it assumes you're in a non-interactive environment.

• useFancyQuotes = FALSE so base R functions always use regular (straight) quotes (otherwise the default is locale dependent, see sQuote() for details).

• width = 80 to control the width of printed output (usually this varies with the size of your console).

It also sets envvars RSTUDIO = 0 (which ensures that RStudio is never detected as running), and TESTTHAT = "true" (which ensures that is_testing() returns TRUE), and sets collation locale to "C" (which ensures that character sorting the same regardless of current locale).

local_test_context(.env = parent.frame())

## Arguments

.env Environment to use for scoping; expert use only.