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
library
before context
throws error?
#700
Comments
I'd say yes, |
Re-opening because this bug is super confusing |
Hi Chaps, Did this one get resolved? I am still experiencing this issue. Cheers |
I didn't have a "context()" line in any of my tests either. Adding a context() line as the first line of each of my test-*.R scripts fixed this issue for me. No more "Error in x[method] : attempt to apply non-function" error. |
I noticed that if a test failed and there was no context() call, then devtools::test() reports no error on the file, but does report an error in the summary at the end. Well, anyway, that's my hypothesis based on a recent bug (which came up whilst setting up firebreaks for the C++ transition). The following URL makes me think it's *mandatory* to have context() calls. Who knew, and how come devtools() doesn't tell us about that problem? r-lib/testthat#700
Seems to fix issues from r-lib/testthat#700
Test files without an explicit `context()` would cause Error in x[[method]](...) : attempt to apply non-function errors in the Progress reporter and a different (unreported) error in the JUnit reporter. This generates a context from the filename if there is not already a defined context, fixing the issue. Fixes r-lib#700 Fixes r-lib#705
Test files without an explicit `context()` would cause Error in x[[method]](...) : attempt to apply non-function errors in the Progress reporter and a different (unreported) error in the JUnit reporter. This generates a context from the filename if there is not already a defined context, fixing the issue. Fixes #700 Fixes #705
Is there any way to update the example code in the "Testing" chapter of "R packages" (http://r-pkgs.had.co.nz/tests.html)? It currently has a
|
… string creation.
@ctberthiaume I sent a PR to the book at hadley/r-pkgs#478 |
Addresses bug in testthat. See r-lib/testthat#700 (comment)
I had to create a line with context() in each test. This seems to be a bug. (Version 2.0.0) |
Is it not a bug to have context mandatory ? |
Hoping this is reproducible:
usethis::use_testthat()
usethis::use_test("example")
test-example.R
todevtools::test()
givesbut if the
context
comes beforelibrary
intest-example.R
, everything works. Is this expected? I'm usingtestthat 2.0.0
.The text was updated successfully, but these errors were encountered: