From 902ce59c3504b828221fd4ad3511ab4369a8c683 Mon Sep 17 00:00:00 2001 From: luciorq Date: Thu, 5 Dec 2024 10:26:07 -0500 Subject: [PATCH] tests: run tests on temp directory --- tests/testthat/setup.R | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 3859a7b..68fc86f 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -6,3 +6,17 @@ withr::local_options( ), .local_envir = testthat::teardown_env() ) + +# fs::path(local_temp_dir, "home") +# fs::path_temp("tmp", "home", "data") + +withr::local_envvar( + .new = list( + `HOME` = fs::path_temp("tmp", "home"), + `USERPROFILE` = fs::path_temp("tmp", "home"), + `LOCALAPPDATA` = fs::path_temp("tmp", "home", "data"), + `APPDATA` = fs::path_temp("tmp", "home", "data"), + `R_USER_DATA_DIR` = fs::path_temp("tmp", "home", "data"), + `XDG_DATA_HOME` = fs::path_temp("tmp", "home", "data") + ) +)