-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
propagate repos when running renv::init()
- Loading branch information
1 parent
f2a7b91
commit d4eac9a
Showing
5 changed files
with
162 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
# test-renv.R | ||
# | ||
# Copyright (C) 2020 by RStudio, PBC | ||
# | ||
# Unless you have received this program directly from RStudio pursuant | ||
# to the terms of a commercial license agreement with RStudio, then | ||
# this program is licensed to you under the terms of version 3 of the | ||
# GNU Affero General Public License. This program is distributed WITHOUT | ||
# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, | ||
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the | ||
# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. | ||
# | ||
# | ||
|
||
context("renv") | ||
|
||
test_that(".rs.rpc.renv_init() preserves current repositories", { | ||
|
||
skip_if_not_installed("renv") | ||
|
||
# scope repos option in this scope | ||
renv:::renv_scope_options( | ||
repos = list(RSPM = "https://packagemanager.rstudio.com/cran/latest") | ||
) | ||
|
||
# initialize project | ||
project <- tempfile("renv-project-") | ||
on.exit(unlink(project, recursive = TRUE), add = TRUE) | ||
.rs.rpc.renv_init(project) | ||
|
||
# check that the renv lockfile has the expected repositories | ||
lockpath <- file.path(project, "renv.lock") | ||
lockfile <- renv:::renv_lockfile_read(lockpath) | ||
|
||
# validate correct repositories | ||
expect_identical( | ||
as.list(lockfile$R$Repositories), | ||
list(RSPM = "https://packagemanager.rstudio.com/cran/latest") | ||
) | ||
|
||
}) |