Skip to content

Commit 5550c98

Browse files
authored
Ensure JunitReporter alway uses . for decimal (#1885)
Fixes #1660
1 parent c0845db commit 5550c98

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS.md

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

3+
* `JunitReporter()` now uses ensures numeric values are saved the xml file
4+
with `.` as decimal separator. (@maksymiuks, #1660)
5+
36
# testthat 3.2.0
47

58
## Lifecycle changes

R/reporter-junit.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ JunitReporter <- R6::R6Class("JunitReporter",
8585
},
8686

8787
end_context = function(context) {
88+
# Always uses . as decimal place in output regardless of options set in test
89+
withr::local_options(list(OutDec = "."))
8890
xml2::xml_attr(self$suite, "tests") <- as.character(self$tests)
8991
xml2::xml_attr(self$suite, "skipped") <- as.character(self$skipped)
9092
xml2::xml_attr(self$suite, "failures") <- as.character(self$failures)
@@ -96,6 +98,7 @@ JunitReporter <- R6::R6Class("JunitReporter",
9698
},
9799

98100
add_result = function(context, test, result) {
101+
withr::local_options(list(OutDec = "."))
99102
self$tests <- self$tests + 1
100103

101104
time <- self$elapsed_time()

0 commit comments

Comments
 (0)