Closed cbeleites closed 3 years ago
Originally I wrote this as my comment in #27 but, I think, here is a better place for discussions.
Wouldn't it be easier to use testthat
edition 3, which automatically sets the language to English:
In https://www.tidyverse.org/blog/2020/10/testthat-3-0-0/:
test_that()
now sets a number of options and env vars to make output as reproducible as possible. Many of these options were previously set in various places (includingdevtools::test()
,test_dir()
,test_file()
, andverify_output()
) but they have now been centralised in tolocal_test_context()
.
In the Details section of local_test_context()
documentation:
In the third edition,
local_test_context()
also callslocal_reproducible_output()
which temporary sets the following options:...
And modifies the following env vars:
- Unsets
RSTUDIO
, which ensures that RStudio is never detected as running.- Sets
LANGUAGE = "en"
, which ensures that no message translation occurs.Finally, it sets the collation locale to "C", which ensures that character sorting the same regardless of system locale.
So I suggest trying testthat
edition 3. If it fails, then considering merging this PR.
Is it OK with you, @cbeleites?
That's fine with me.
Though we need to consider a few more things: e.g. edition 3 h has context()
deprecated - which we very much rely on with hySpc.testthat.
The more I think about this, the more I think that @bryanhanson's roxut package is a much better solution than hySpc.testthat.
A number of unit tests fail if the
LANGUAGE
environment variable is other than English.