test.data.table() in non-English R session#3553
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3553 +/- ##
==========================================
+ Coverage 97.55% 97.55% +<.01%
==========================================
Files 66 66
Lines 12667 12672 +5
==========================================
+ Hits 12357 12362 +5
Misses 310 310
Continue to review full report at Codecov.
|
|
I would go the other way, during |
|
@jangorecki I believe that's what |
|
In such case I would close #3039 as won't fix, it unnecessarily adds complexity. We don't want to test error translations. Eventually we can fill R bugzilla issue for providing such capability. |
| # are R's messages being translated to a foreign language? #3039, #630 | ||
| txt = eval(parse(text="tryCatch(mean(not__exist__), error = function(e) e$message)"), envir=.GlobalEnv) | ||
| foreign = txt != "object 'not__exist__' not found" | ||
| if (foreign) cat("\n**** This R session's language is not English. Each test will still check that the correct number of errors and/or\n", |
There was a problem hiding this comment.
nice idea. excellent.
There was a problem hiding this comment.
Great. I did try (again) to change the language to English from within test.data.table() but it quickly got complicated and OS-specific. Plus with the link you found about caching the translations. Yep so I figured it would be cleaner to inform user how to change their language and rerun if they want the full-strength test, otherwise just checking the number of errors/warnings is still pretty fine.
|
yep... the number of errors relying on base R translations is pretty small
so I thought quitting test.data.table() over a bad locale to be a bit much.
this is v good
…On Fri, May 17, 2019, 8:18 AM Matt Dowle ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In R/test.data.table.R
<#3553 (comment)>
:
> @@ -60,6 +60,13 @@ test.data.table <- function(verbose=FALSE, pkg="pkg", silent=FALSE, with.other.p
cat("Running", fn, "\n")
env = new.env(parent=.GlobalEnv)
assign("testDir", function(x) file.path(fulldir, x), envir=env)
+
+ # are R's messages being translated to a foreign language? #3039, #630
+ txt = eval(parse(text="tryCatch(mean(not__exist__), error = function(e) e$message)"), envir=.GlobalEnv)
+ foreign = txt != "object 'not__exist__' not found"
+ if (foreign) cat("\n**** This R session's language is not English. Each test will still check that the correct number of errors and/or\n",
Great. I did try (again) to change the language to English from within
test.data.table() but it quickly got complicated and OS-specific. Plus with
the link you found about caching the translations. Yep so I figured it
would be cleaner to inform user how to change their language and rerun if
they want the full-strength test, otherwise just checking the number of
errors/warnings is still pretty fine.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3553?email_source=notifications&email_token=AB2BA5IFUF6LTPS47FH4KXLPVX2VHA5CNFSM4HLZLFKKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBY5CWNI#discussion_r284942179>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB2BA5KX6Y2EA7OCW3KR4SDPVX2VHANCNFSM4HLZLFKA>
.
|
Closes #3039
Closes #630
This is an approach that would work to solve #3039.
But, it feels a bit hacky/manual, so filing this as a test balloon for now.
Less-than-ideal alternative would be something like:
then branch on
if (was_translated)for subsequentgettext-dependent tests...