-
Notifications
You must be signed in to change notification settings - Fork 10
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
Working directory friction #214
Comments
I think I sorted out what is going on - it is supposed to throw an error if the function is called outside of a package/packet. However, because the workshop is a project overall, it finds and sets the root to the workshops root. When it searches for the config, it finds all the various config files within the workshop, and lists all of them. Which leads to your error, @wlandau, because the path gets sent to reprex code: library(valtools)
library(testthat)
test_that("Informative error when inside an Rproj, but packet or package is nested in a subfolder", {
withr::with_tempdir({
quiet <- capture.output({
usethis::create_project("test_project",open = FALSE)
vt_create_packet("test_project/example_packet",
target = "example.package",
open = FALSE)
vt_create_packet("test_project/example_packet2",
target = "example.package",
open = FALSE)
})
withr::with_dir(new = "test_project", {
expect_error(
vt_find_config(),
paste0(
"Could not find root directory. ",
"Is your working directory inside a package, validation packet, or project?\n"
),
fixed = TRUE)
})
})
}) |
@wlandau, would it have been useful for an error to point to the fact that you were in a situation of nested projects, and you needed to change directories? I have a PR opened in #217 that makes it so it would give an error like below:
|
Yes, that definitely would have helped. I was confused about what working directory I needed, especially since the workshop example was not part of an R package. |
valtools
seems to require the working directory to be the root of the validation file space, not the root of the package. If I try this command, but withname
equal tofile.path("r_pharma_validation", "req1.md")
and my working directory one level up, I get an error and warnings. This took a few minutes to debug during the workshop today.The text was updated successfully, but these errors were encountered: