Skip to content

Commit 674cdf3

Browse files
committed
Set LANGUAGE to "C"
1 parent 43d13d5 commit 674cdf3

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ Config/testthat/parallel: true
5555
Config/testthat/start-first: watcher, parallel*
5656
Encoding: UTF-8
5757
Roxygen: list(markdown = TRUE, r6 = FALSE)
58-
RoxygenNote: 7.2.3
58+
RoxygenNote: 7.3.2

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# testthat (development version)
22

3+
* `LANGUAGE` is now set to `"C"` in reprocucible environments (i.e.
4+
`test_that()` blocks) to disable translations. This fixes warnings
5+
about being unable to set the language to `"en"` (#1925).
6+
37
# testthat 3.2.1
48

59
* Fix incorrect format string detected by latest R-devel. Fix thanks to

R/local.R

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ local_reproducible_output <- function(width = 80,
9898
unicode = FALSE,
9999
rstudio = FALSE,
100100
hyperlinks = FALSE,
101-
lang = "en",
101+
lang = "C",
102102
.env = parent.frame()) {
103103

104104
if (unicode) {
@@ -133,12 +133,7 @@ local_reproducible_output <- function(width = 80,
133133
.local_envir = .env
134134
)
135135

136-
if (isTRUE(capabilities("NLS"))) {
137-
suppressWarnings(
138-
withr::local_language(lang, .local_envir = .env)
139-
)
140-
}
141-
136+
withr::local_language(lang, .local_envir = .env)
142137
withr::local_collate("C", .local_envir = .env)
143138
}
144139

man/local_test_context.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-local.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_that("local context is 'as promised' inside test_that()", {
2121
expect_equal(getOption("max.print"), 99999)
2222

2323
expect_equal(Sys.getenv("RSTUDIO"), "")
24-
expect_equal(Sys.getenv("LANGUAGE"), "en")
24+
expect_equal(Sys.getenv("LANGUAGE"), "C")
2525

2626
expect_equal(Sys.getlocale("LC_COLLATE"), "C")
2727
})

0 commit comments

Comments
 (0)