-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for test.data.table()
in foreign mode
#6808
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6808 +/- ##
=======================================
Coverage 98.64% 98.64%
=======================================
Files 79 79
Lines 14639 14642 +3
=======================================
+ Hits 14440 14444 +4
+ Misses 199 198 -1 ☔ View full report in Codecov by Sentry. |
Generated via commit 81b09fb Download link for the artifact containing the test results: ↓ atime-results.zip
|
This is already done for warnings and errors. Unfortunately, some tests do check output and conditions by hand, so test.data.table() still requires LANGUAGE=en for now.
A comment near 1832.2 said that output= was inapplicable due to square bracket matching. The actual source of the problem was the caret only matching start of string instead of start of line.
While not all all.equal() output is translated, those cases that are result in test failures when comparing the output in test() calls. Use output= so that the test would be skipped in 'foreign' mode.
We already only count warnings in foreign mode, don't match their text contents. With ignore.warning set, we lack a way to figure out when the translated warning should be skipped, so don't count them at all.
The length(output) || length(notOutput) branch makes length(output) at least 1. Later, 'y' value check is skipped if length(output) is nonzero. Instead of skipping this branch altogether in foreign mode, make sure that it's taken so that the 'y' value check is later skipped when foreign mode is on.
Instead of applying passed options= for the rest of the call frame, undo them immediately after evaluating the call. This prevents testing for options(datatable.alloccol=...) from breaking the internal data.table usage and allows rewriting the tests using the options=... and error=... arguments, which skip tests as appropriate in foreign mode.
f48097b
to
2068510
Compare
The important part now exists as #6811. May need more changes if more of |
test(432.3, inherits(err3,"try-error") && grep("is a numeric vector ok but its length is 2. Its length should be 1.", err3)) | ||
test(432.4, inherits(err4,"try-error") && grep("It must be >=0 and not NA.", err4)) | ||
test(432.5, inherits(err5,"try-error") && grep("It must be >=0 and not NA.", err5)) | ||
# Test that unsetting datatable.alloccol is caught, #2014 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great fix & modernization!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! For posterity please also tidy up the PR description which still discusses the catf()
part that was split off to #6811.
test.data.table()
test.data.table()
in foreign mode
This is to improve the the quality of life when running
test.data.table()
without an English locale set or translation disabled. Tests that previously usedcapture.output
now useoutput=...
, which is skipped in foreign mode. Tests are also skipped in foreign mode forignore.warnings
andnotOutput
.