-
Notifications
You must be signed in to change notification settings - Fork 337
Description
Hi,
I identified the following issue while trying to read back a junit file created for ggplot2
test suite. In this package, one of the tests is executed with a different option for decimal separator (https://github.com/tidyverse/ggplot2/blob/main/tests/testthat/test-aes.r#L19-L25). Therefore when testthat collects junit data it uses an altered option and due to the as.character()
time is saved using a comma as separator (
Line 93 in 426eb52
xml2::xml_attr(self$suite, "time") <- as.character(round(self$suite_time, 3)) |
In the case of the come, the issue is not that huge, but it sep option can be set to an arbitrary sign rendering the time field useless to read back for someone unaware. As the issue comes from the as.character(), I suggested the following change
xml2::xml_attr(self$suite, "time") <- withr::with_options(list(OutDec = "."), as.character(round(self$suite_time, 3)))
thanks to that we won't compromise any test environment but at the same time always get numbers in a standard format recognizable by any system - with point as decimal separator. I've checked and withr
is already a dependency so it won't add any new.
Let me know what you think about this suggestion, I'm happy to prepare a PR if you agree with my evaluation and approach.