Skip to content

Commit

Permalink
Set LANGUAGE to "C"
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Oct 28, 2024
1 parent 43d13d5 commit 674cdf3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Config/testthat/parallel: true
Config/testthat/start-first: watcher, parallel*
Encoding: UTF-8
Roxygen: list(markdown = TRUE, r6 = FALSE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# testthat (development version)

* `LANGUAGE` is now set to `"C"` in reprocucible environments (i.e.
`test_that()` blocks) to disable translations. This fixes warnings
about being unable to set the language to `"en"` (#1925).

# testthat 3.2.1

* Fix incorrect format string detected by latest R-devel. Fix thanks to
Expand Down
9 changes: 2 additions & 7 deletions R/local.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ local_reproducible_output <- function(width = 80,
unicode = FALSE,
rstudio = FALSE,
hyperlinks = FALSE,
lang = "en",
lang = "C",
.env = parent.frame()) {

if (unicode) {
Expand Down Expand Up @@ -133,12 +133,7 @@ local_reproducible_output <- function(width = 80,
.local_envir = .env
)

if (isTRUE(capabilities("NLS"))) {
suppressWarnings(
withr::local_language(lang, .local_envir = .env)
)
}

withr::local_language(lang, .local_envir = .env)
withr::local_collate("C", .local_envir = .env)
}

Expand Down
2 changes: 1 addition & 1 deletion man/local_test_context.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-local.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test_that("local context is 'as promised' inside test_that()", {
expect_equal(getOption("max.print"), 99999)

expect_equal(Sys.getenv("RSTUDIO"), "")
expect_equal(Sys.getenv("LANGUAGE"), "en")
expect_equal(Sys.getenv("LANGUAGE"), "C")

expect_equal(Sys.getlocale("LC_COLLATE"), "C")
})
Expand Down

0 comments on commit 674cdf3

Please sign in to comment.