Skip to content

Commit 2845e47

Browse files
committed
Add setup for user cache directory in tests to prevent pak subprocess failures
1 parent 49aeeb7 commit 2845e47

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/testthat/setup-pak.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# pak (via pkgcache) requires a user cache directory.
2+
# In CI environments or during R CMD check, this might not be set,
3+
# causing pak subprocesses to fail.
4+
if (Sys.getenv("R_USER_CACHE_DIR") == "") {
5+
# Use a temporary directory for the cache during tests
6+
Sys.setenv(R_USER_CACHE_DIR = tempfile("pak-cache-"))
7+
}

0 commit comments

Comments
 (0)