-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix logic error checking autoload envvar (#1584)
* fix logic error checking autoload envvar * fixup for windows
- Loading branch information
1 parent
ab1ff5f
commit acc968a
Showing
7 changed files
with
65 additions
and
7 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
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,48 @@ | ||
|
||
test_that("autoload() works", { | ||
skip_on_cran() | ||
|
||
# TODO: Failed on Windows CI, but works locally? | ||
skip_on_windows() | ||
|
||
project <- renv_tests_scope() | ||
|
||
# initialize renv project here | ||
init() | ||
|
||
# make sure we have renv installed for this test | ||
libpaths <- the$libpaths[[".libPaths()"]] | ||
source <- find.package("renv", lib.loc = libpaths) | ||
renv_imbue_self(project, source = source) | ||
|
||
# make sure autoloader is enabled in this scope | ||
renv_scope_envvars(RENV_AUTOLOAD_ENABLED = "TRUE") | ||
|
||
# make sure default library paths are visible to child process | ||
renv_scope_envvars( | ||
R_LIBS = paste(libpaths, collapse = .Platform$path.sep), | ||
R_LIBS_USER = NULL, | ||
R_LIBS_SITE = NULL | ||
) | ||
|
||
# move to sub-directory | ||
dir.create("subdir") | ||
renv_scope_wd("subdir") | ||
|
||
# create a .Rprofile that calls renv::autoload() | ||
profile <- renv_test_code({ | ||
renv::autoload() | ||
}) | ||
|
||
renv_scope_envvars(R_PROFILE_USER = profile) | ||
|
||
# launch R and see what library paths we got | ||
output <- renv_system_exec( | ||
command = R(), | ||
args = c("-s", "-e", renv_shell_quote("writeLines(.libPaths())")), | ||
action = "testing autoload" | ||
) | ||
|
||
expect_equal(output, .libPaths()) | ||
|
||
}) |
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