Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests failing with LANGUAGE different than English #26

Closed
cbeleites opened this issue Jul 31, 2021 · 2 comments · Fixed by #28 · May be fixed by #27
Closed

unit tests failing with LANGUAGE different than English #26

cbeleites opened this issue Jul 31, 2021 · 2 comments · Fixed by #28 · May be fixed by #27

Comments

@cbeleites
Copy link
Collaborator

A number of unit tests fail if the LANGUAGE environment variable is other than English.

@cbeleites cbeleites added this to the 1.0 CRAN submission milestone Jul 31, 2021
@cbeleites cbeleites self-assigned this Jul 31, 2021
@GegznaV GegznaV linked a pull request Jul 31, 2021 that will close this issue
@GegznaV
Copy link
Member

GegznaV commented Aug 3, 2021

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 (including devtools::test(), test_dir(), test_file(), and verify_output()) but they have now been centralised in to local_test_context().

In the Details section of local_test_context() documentation:

In the third edition, local_test_context() also calls local_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?

@cbeleites
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment