Improved verbosity of data.table:::test() function for mismatched expected warnings#7706
Improved verbosity of data.table:::test() function for mismatched expected warnings#7706lucaslarson25 wants to merge 3 commits intoRdatatable:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7706 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 87 87
Lines 17037 17037
=======================================
Hits 16874 16874
Misses 163 163 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| test(2367.6, fread(file(f)), data.table(), warning="Connection has size 0.") | ||
| unlink(f) | ||
|
|
||
| # multiple expected/observed warnings in test() are printed on aligned lines, #7092 |
There was a problem hiding this comment.
This is interesting. I don't think test data.table tested its test() function before. Now we can have tests purposefully failing tests so that the outer test can succeed (and the coverage can be increased, removing the # nocov start ... # nocov end comments).
Maybe we need a separate test file for this?
There was a problem hiding this comment.
this comment is relevant:
data.table/R/test.data.table.R
Line 450 in 8364344
tests in this PR seems to follow that
Fixed NEWS.md punctuation and spacing. Co-authored-by: aitap <krylov.r00t@gmail.com>
Closes #7092.
Previously, the data.table:::test() function would print out expected warnings separately:
This was caused by using paste() with the array of expected warnings. To fix this, we collapse these arrays using a new function
align_messages.This behavior was caused by multiple expected warnings, or multiple observed warnings in the test function.
Now the test function will output multiple expected and/or observed warnings correctly:
Also, created new tests in inst/tests/tests.Rraw file as well as updated the NEWS.md file.