Skip to content

Commit 5a10248

Browse files
authored
Make sure cli is installed in .libPaths()[2] (#2693)
1 parent 75eac87 commit 5a10248

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

tests/testthat/test-install.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,26 @@ test_that("install reports stages", {
2121
)
2222
})
2323

24-
test_that("install() doesn't reinstall deps already in non-primary libpath", {
24+
test_that("install() doesn't reinstall deps that are already installed", {
2525
skip_on_cran()
2626

2727
pkg <- local_package_copy(test_path("testInstallWithDeps"))
28+
29+
# Install cli into a temp lib via pak, to make extra sure that
30+
# pak considers it already satisfied when install() runs.
31+
withr::local_temp_libpaths()
32+
33+
# It's very hard to silence pak.
34+
local({
35+
withr::local_output_sink(withr::local_tempfile())
36+
withr::local_message_sink(withr::local_tempfile())
37+
withCallingHandlers(
38+
pak::pkg_install("cli", lib = .libPaths()[1], ask = FALSE),
39+
callr_message = function(cnd) tryInvokeRestart("muffleMessage")
40+
)
41+
})
42+
43+
# Prepend a second temp lib in which to install the in-development package.
2844
withr::local_temp_libpaths()
2945
tmp_lib <- .libPaths()[1]
3046

0 commit comments

Comments
 (0)