Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Imports:
rlang (>= 1.1.1),
utils,
waldo (>= 0.5.1),
withr (>= 2.5.0)
withr (>= 3.0.2)
Suggests:
covr,
curl (>= 0.9.5),
Expand All @@ -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
7 changes: 2 additions & 5 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,10 +133,7 @@ local_reproducible_output <- function(width = 80,
.local_envir = .env
)

if (isTRUE(capabilities("NLS")) && Sys.getenv("LANG") != "C") {
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
Loading