-
Notifications
You must be signed in to change notification settings - Fork 323
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
Restore test_dir(..., wrap = FALSE)
#1183
Conversation
Hmm, I'll need to look into why the CI tests are failing despite having In the meantime, @hadley any feedback on whether the concept of |
R/test-files.R
Outdated
@@ -150,10 +163,18 @@ test_files <- function(test_dir, | |||
env = NULL, | |||
stop_on_failure = FALSE, | |||
stop_on_warning = FALSE, | |||
wrap = lifecycle::deprecated(), |
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.
Just make this TRUE
and then warn if wrap
is FALSE
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.
Done.
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.
Overall, it's fine, but I made a couple of suggestions for simplifying it, since you're the only person who needs it.
R/test-files.R
Outdated
@@ -98,6 +94,22 @@ test_dir <- function(path, | |||
reporter <- find_reporter(reporter) | |||
parallel <- want_parallel && reporter$capabilities$parallel_support | |||
|
|||
if (parallel) { | |||
if (!is_missing(wrap)) { |
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.
Given that you're the only person using this argument, I think you can just keep the warning the same for both serial and parallel.
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.
Ok, I did this. If for whatever reason someone ends up using wrap=FALSE
in parallel mode they might be confused, but given they will get a deprecation warning hopefully they'll figure it out, and more likely such a person won't exist anyway.
Note we use the 'test_dir' deprecation warning in 'test_files' as that line may be triggered from either 'test_file' or 'test_dir'. In the docs 'test_file' is described as 'a variant of test_dir()...' so it seems ok for 'test_file' to trigger a deprecation warning with 'test_dir' in it.
In re failing tests, I looked at this for a bit, and it's going wrong with errors of this form (among others):
Or:
I could not reproduce locally on OS X R4.0.2, but did reproduce it on Ubuntu 18.04 with r-devel. The error seems related to the |
In order to avoid conflict with r-lib#1184
Thanks! |
Update here: I no longer rely on the ability to turn |
In some unusual cases it is useful to be able to preserve the
original
testthat
behavior of not wrapping expressions outsideof
test_that
blocks.In commit 37cc0d0
control of the
wrap
functionality was removed fromtest_dir
,but after discussion in #498 it was restored.
More recently, b13ecb3
removed the
wrap
functionality again fromtest_dir
. This patchseeks to restore the functionality for serial tests only as restoring it
for parallel tests is more complicated and of dubious value since
a) the parameter is now deprecated, and b) parallel tests did not
exist prior to deprecation.
Bonus typo fixes.