@@ -60,8 +60,7 @@ test_that("fail", {
6060
6161test_that(" snapshots" , {
6262 withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
63- withr :: defer(unlink(tmp , recursive = TRUE ))
64- dir.create(tmp <- tempfile(" testthat-snap-" ))
63+ tmp <- withr :: local_tempdir(" testthat-snap-" )
6564 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
6665 # we cannot run these with the silent reporter, because it is not
6766 # parallel compatible, and they'll not run in parallel
@@ -82,11 +81,11 @@ test_that("snapshots", {
8281})
8382
8483test_that(" new snapshots are added" , {
85- withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
86- withr :: defer(unlink(tmp , recursive = TRUE ))
87- dir.create(tmp <- tempfile(" testthat-snap-" ))
84+ withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" , CI = " false" ))
85+ tmp <- withr :: local_tempdir(" testthat-snap-" )
8886 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
8987 unlink(file.path(tmp , " snap" , " tests" , " testthat" , " _snaps" , " snap-2.md" ))
88+
9089 # we cannot run these with the silent reporter, because it is not
9190 # parallel compatible, and they'll not run in parallel
9291 capture.output(suppressMessages(
@@ -107,13 +106,13 @@ test_that("new snapshots are added", {
107106
108107test_that(" snapshots are removed if test file has no snapshots" , {
109108 withr :: local_envvar(c(TESTTHAT_PARALLEL = " TRUE" ))
110- withr :: defer(unlink(tmp , recursive = TRUE ))
111- dir.create(tmp <- tempfile(" testthat-snap-" ))
109+ tmp <- withr :: local_tempdir(" testthat-snap-" )
112110 file.copy(test_path(" test-parallel" , " snap" ), tmp , recursive = TRUE )
113111 writeLines(
114112 " test_that(\" 2\" , { expect_true(TRUE) })" ,
115113 file.path(tmp , " snap" , " tests" , " testthat" , " test-snap-2.R" )
116114 )
115+
117116 # we cannot run these with the silent reporter, because it is not
118117 # parallel compatible, and they'll not run in parallel
119118 capture.output(suppressMessages(
0 commit comments