Comments (10)
Failure with Rscript but not R, usually indicates that I've forgotten to declare a base R package dependency.
from testthat.
Seems to be something to do with ReferenceClasses...
$ Rscript -e "library(testthat); library(methods); SummaryReporter$new"
NULL
whereas the same in an interactive session prints out a class method definition. But I can't see any difference in the sessionInfo() between the two cases, arrgh
from testthat.
It works with R -e
, but not with Rscript
, but I don't see any differences in sessionInfo
either:
public : R -e "library(testthat); sessionInfo()"
> library(testthat); sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics utils datasets grDevices methods base
other attached packages:
[1] testthat_0.6
loaded via a namespace (and not attached):
[1] evaluate_0.3 plyr_1.7.1 stringr_0.6
>
>
public : Rscript -e "library(testthat); sessionInfo()"
R version 2.14.1 (2011-12-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics utils datasets grDevices base
other attached packages:
[1] testthat_0.6
loaded via a namespace (and not attached):
[1] evaluate_0.3 plyr_1.7.1 stringr_0.6
from testthat.
Oh, except that methods is missing, and order seems to matter:
Rscript -e "library(methods); library(testthat); SummaryReporter\$new"Class method definition for method new()
function (...)
{
methods::new(def, ...)
}
<environment: 0x102fe10a8>
Methods used:
"methods", "new"
from testthat.
I think this bug is still live. I've install_github
ed from master.
I run auto test via R -e
from within a Makefile, though it also occurs in interactive sessions. I think it cropped up when I upgraded 2.14, though I'm not actually sure.
testthat will run the tests initially just fine. If I change the source documents, the tests are properly restarted and run. However, when I change a test file, I get:
Rerunning tests: test.testStatistics.R
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
"new" is not a valid field or method name for reference class “SummaryReporter”
While not necessarily the cleanest test case, you can run my tests via:
$ git clone [email protected]:markmfredrickson/RItools.git
$ cd RItools
$ make autotest
... add a space to tests/test.*
from testthat.
I'm still having this bug with R 2.15.0 and testthat 0.6. when running a script via Rscript
Error in find_reporter(reporter) : attempt to apply non-function
Calls: test_dir -> find_reporter
Execution halted
With a simple tests.R using test_dir():
#!/usr/bin/env Rscript
library("testthat")
test_dir("distributions/tests/")
+1 to reopen the issue.
from testthat.
@xuanxu - you need the development version from github.
@markmfredrickson - that sounds like a different bug (which I'm pretty sure I've also fixed)
from testthat.
@markmfredrickson - that sounds like a different bug (which I'm pretty sure I've also fixed)
Confirmed. Thanks!
from testthat.
Thanks @hadley, is there a new version release planned anytime soon?
from testthat.
Yes, hopefully in the next week or two.
from testthat.
Related Issues (20)
- unstable behavior of expect_equal on two numeric arrays depending on `tolerance` value HOT 2
- expect_equals sometimes reports incorrect values when values are not equal HOT 1
- Test failures in version 3.2.1.1 HOT 1
- line end with snapshots? HOT 4
- Should there be the reject button in `snapshot_review()`?
- expect_setequal error message is reversed HOT 1
- `skip_if_offline()` complaining about missing curl package on ghactions but curl is installed HOT 1
- Tests fail unless I add source('setup.R') data to test file
- Could the stack trace of `expect_no_*()` be reduced? HOT 1
- expect_visible() does not print a correct error message
- Proposal: add a custom signal class for skip(), then sort skip notes by class HOT 2
- Exported functions missing from "Expectation Internals" section of website's reference index HOT 2
- Installation on R < 4.0 fails on `evaluate` now requiring R >= 4.0 HOT 4
- Easy way to globally and permanently set testthat edition
- Ability to filter tests globally based on the test description
- Feature Proposal: Additional test roxygen headers for more granular metadata
- vdiffr vs testthat::expect_snapshot() for plots HOT 1
- Parallel testing in Azure DevOps Pipelines
- POSIXct objects that differ by fractional seconds are considered equal when run manually but not within `reprex()`
- `test_path()` returns incorrect value in context of `test_coverage_active_file()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testthat.