You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the R subdirectory of the package, whereas it's the package's root directory when using devtools::check().
Are you using the version of devtools that lets you call test() and other functions from any subdirectory, and is your current working directory the R/ subdirectory? I believe devtools::test() just runs in the current working dir.
@hadley: Thanks -- system.file seems to return the correct path. However, this means that I need to figure out the name of the package that is being installed -- getNamespaceName(parent.frame()) didn't produce useful results for the test() and document() cases but works for R CMD check and R CMD INSTALL. (I'll take a look at this issue as well -- according to getNamespaceInfo it seems that we need to place an object named .__NAMESPACE__. in the package's environment.) I have updated the test package.
@wch: No, CWD is package root when running those tests.
@gaborcsardi: Thanks, didn't know that. This function expects an object named .packageName in the environment. Actually, both packageName() and getNamespaceName(...) seem to work from devtools -- not sure why I assumed otherwise.