From 37508b493134ba51d7b1da2e63fec6d04b26feb5 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 13 Aug 2025 09:49:55 -0500 Subject: [PATCH] Maybe it's testing parallelism within the tests? --- tests/testthat/test-parallel-outside.R | 1 + tests/testthat/test-parallel-teardown.R | 1 + tests/testthat/test-parallel.R | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/tests/testthat/test-parallel-outside.R b/tests/testthat/test-parallel-outside.R index 180b25487..e1ca91383 100644 --- a/tests/testthat/test-parallel-outside.R +++ b/tests/testthat/test-parallel-outside.R @@ -1,4 +1,5 @@ test_that("error outside of test_that()", { + skip_on_covr() withr::local_envvar(TESTTHAT_PARALLEL = "TRUE") err <- tryCatch( capture.output(suppressMessages(testthat::test_local( diff --git a/tests/testthat/test-parallel-teardown.R b/tests/testthat/test-parallel-teardown.R index b3a2dd765..b0eee4338 100644 --- a/tests/testthat/test-parallel-teardown.R +++ b/tests/testthat/test-parallel-teardown.R @@ -1,5 +1,6 @@ test_that("teardown error", { skip("teardown errors are ignored") + skip_on_covr() withr::local_envvar(TESTTHAT_PARALLEL = "TRUE") err <- tryCatch( capture.output(suppressMessages(testthat::test_local( diff --git a/tests/testthat/test-parallel.R b/tests/testthat/test-parallel.R index 634529b32..f0f50c387 100644 --- a/tests/testthat/test-parallel.R +++ b/tests/testthat/test-parallel.R @@ -26,6 +26,7 @@ test_that("good error if bad option", { }) test_that("ok", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE")) # we cannot run these with the silent reporter, because it is not # parallel compatible, and they'll not run in parallel @@ -43,6 +44,7 @@ test_that("ok", { }) test_that("fail", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE")) # we cannot run these with the silent reporter, because it is not # parallel compatible, and they'll not run in parallel @@ -59,6 +61,7 @@ test_that("fail", { }) test_that("snapshots", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE")) tmp <- withr::local_tempdir("testthat-snap-") file.copy(test_path("test-parallel", "snap"), tmp, recursive = TRUE) @@ -81,6 +84,7 @@ test_that("snapshots", { }) test_that("new snapshots are added", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE", CI = "false")) tmp <- withr::local_tempdir("testthat-snap-") file.copy(test_path("test-parallel", "snap"), tmp, recursive = TRUE) @@ -105,6 +109,7 @@ test_that("new snapshots are added", { }) test_that("snapshots are removed if test file has no snapshots", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE")) tmp <- withr::local_tempdir("testthat-snap-") file.copy(test_path("test-parallel", "snap"), tmp, recursive = TRUE) @@ -132,6 +137,7 @@ test_that("snapshots are removed if test file has no snapshots", { }) test_that("snapshots are removed if test file is removed", { + skip_on_covr() withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE")) withr::defer(unlink(tmp, recursive = TRUE)) dir.create(tmp <- tempfile("testthat-snap-"))