-
Notifications
You must be signed in to change notification settings - Fork 318
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
find_edition()
/ find_description()
may have too strong a preference for an installed package
#1858
Comments
Consulting that |
Maybe |
Also need to consider |
I've made https://github.com/hadley/testcoverage as a test — it contains two tests that will fail if either the edition or the |
This was never used correctly because we're passing the path to the package root, instead of the test directory. Additionally, based on https://github.com/hadley/testcoverage, they don't actually appear to be needed. Fixes r-lib/testthat#1858
Remove unneeded (and harmful) call to `local_test_directory()` from `test_coverage()`. Fixes r-lib/testthat#1858. Rewrite `test_coverage_active_file()` to ensure that test failures are forwarded to the user, and fix the problems (mostly with snapshotting thus revealed).
This is a discovery made during the package development masterclass as posit conf.
We asked participants to check the test coverage for
hadley/stringb
and there would be no reason for anyone to have installed that package. Anddevtools::test_coverage()
fails in this case.It goes like this:
devtools::test_coverage()
➡️testthat::local_test_directory(pkg$path, pkg$package)
➡️find_edition(path, package)
➡️find_description(path, package)
:https://github.com/r-lib/testthat/blob/29018e067f87b07805e55178f387d2a04ff8311f/R/edition.R#L14C1-L23
I think
find_description()
is too eager to consult an installed package. It seems to assume that's safe and preferred if you happen to know the package's name.I was able to "fix" the devtools problem by not passing the package name, but I don't think that's a great solution (r-lib/devtools#2536). That has other downsides, e.g., the package name won't be available for setting the
TESTTHAT_PKG
environment variable.testthat/R/local.R
Line 188 in 29018e0
The text was updated successfully, but these errors were encountered: