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

Warnings when running tests using withr #254

Closed
fh-mthomson opened this issue Jan 25, 2024 · 6 comments
Closed

Warnings when running tests using withr #254

fh-mthomson opened this issue Jan 25, 2024 · 6 comments

Comments

@fh-mthomson
Copy link

Using withr 3.0.0:

testthat::test_that("X",{
  testthat::expect_equal(1, 1)
})
#> Warning in check_language_envvar("LC_ALL"): Changing language has no effect
#> when envvar LC_ALL='C.UTF-8'

#> Warning in check_language_envvar("LC_ALL"): Changing language has no effect
#> when envvar LC_ALL='C.UTF-8'
#> Test passed 🎉

Created on 2024-01-25 with reprex v2.1.0

Downgrading to 2.5.2 resolves the issue.

My best guess is that it's being invoked here: https://github.com/r-lib/withr/blob/main/R/language.R#L53

Platform: Posit Workbench, using an image built on top of https://github.com/rstudio/rstudio-docker-products/pkgs/container/r-session-complete/137811113?tag=jammy-2023.09.0--89f567d

@lionel-
Copy link
Member

lionel- commented Jan 25, 2024

@hadley I'm tempted to never warn. Or maybe only warn when the frame is globalenv(), like in lifecycle? But such usage would be quite rare.

@hadley
Copy link
Member

hadley commented Jan 25, 2024

Yeah, I think that's fine. But maybe we should export a helper like translations_available() or skip_if_no_translations() so there's some way to opt-out if needed?

@lionel-
Copy link
Member

lionel- commented Jan 25, 2024

Good idea. Should the skip_ helper live in testthat or withr?

@hadley
Copy link
Member

hadley commented Jan 25, 2024

I feel like withr? Since that's where the setting is happening?

OTOH most people will probably encounter it from testthat via testthat::local_reproducible_output()? So maybe in testthat?

@lionel-
Copy link
Member

lionel- commented Oct 28, 2024

I now think:

@hadley
Copy link
Member

hadley commented Oct 28, 2024

Handling the remaining part in the testthat issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants