Skip to content

Commit c623d55

Browse files
Don't write to the test directory during testing
Trees and reference items are copied into a test directory. In certain testing environments, the test directory is not writeable. The only safe location to modify files is within tempdir()
1 parent 8bd7267 commit c623d55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/testing.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ test_collection <- function(test, sub_test = NULL,
4141

4242
out_names <- construct_out(in_names)
4343

44-
out_items <- file.path(path, out_names)
4544
in_items <- file.path(path, in_names)
46-
47-
out_trees <- construct_tree(in_items)
45+
out_items <- file.path(tempdir(), out_names)
46+
ref_items <- file.path(path, out_names)
47+
file.copy(ref_items, out_items, overwrite = TRUE, copy.mode = FALSE)
48+
out_trees <- file.path(tempdir(), construct_tree(in_names))
4849

4950
pwalk(list(in_items, out_items, in_names, out_names, out_trees),
5051
transform_and_check,

0 commit comments

Comments
 (0)