-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New strategy to retrieve DESCRIPTION if project uses renv (#931)
Previously we'd always restore the packages from the lockfile, which I had expected to be fast since I had expected the packages to be in the cache. However, this doesn't appear to always be the case, so I instead use a simpler approach where I just force the user to resolve the problem. This means that we can always use the `DESCRIPTION` present in the `.libPaths()` making the code much simpler. Fixes #930
- Loading branch information
Showing
4 changed files
with
39 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# errors if library and project are inconsistent | ||
|
||
Code | ||
parseRenvDependencies(app_dir) | ||
Condition | ||
Error in `parseRenvDependencies()`: | ||
! Library and lockfile are out of sync | ||
i Use renv::restore() or renv::snapshot() to synchronise | ||
i Or ignore the lockfile by adding to you .rscignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,17 @@ test_that("gets DESCRIPTION from renv & system libraries", { | |
expect_type(deps$description[[which(deps$Package == "MASS")]], "list") | ||
}) | ||
|
||
|
||
test_that("errors if library and project are inconsistent", { | ||
withr::local_options(renv.verbose = FALSE) | ||
|
||
app_dir <- local_temp_app(list("foo.R" = "library(foreign); library(MASS)")) | ||
renv::snapshot(app_dir, prompt = FALSE) | ||
renv::record("[email protected]", project = app_dir) | ||
|
||
expect_snapshot(parseRenvDependencies(app_dir), error = TRUE) | ||
}) | ||
|
||
# standardizeRenvPackage ----------------------------------------- | ||
|
||
test_that("SCM get names translated", { | ||
|