Working directory when preparing package for testing in test() #640
Comments
I think that's an accident - it should match But I think you should always be able to use |
Are you using the version of devtools that lets you call |
@hadley: Thanks -- @wch: No, CWD is package root when running those tests. |
Btw. |
Code is explicitly loaded with @gaborcsardi: Thanks, didn't know that. This function expects an object named |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
When testing a package using
devtools::test()
, the current working directory for executing the package's code ("installing" the package into a temporary environment) seems to be theR
subdirectory of the package, whereas it's the package's root directory when usingdevtools::check()
.Test package: https://github.com/krlmlr/test.getwd
Output with
devtools::test()
(copied from RStudio's console):Output with
devtools::check()
: https://github.com/krlmlr/test.getwd/blob/master/test.getwd.Rcheck/00install.out#L4EDIT: It's the same with
devtools::document()
.Is this by design? Otherwise I'd like to take a look at this, so that the CWD is always the package's root.
This is important when the package wants to access stuff in
inst/
during installation: This seems to work with R, but doesn't when testing usingdevtools::test()
.The text was updated successfully, but these errors were encountered: