Skip to content

Commit 132a2ff

Browse files
authored
Skip coverage when launching parallel processes (#2212)
1 parent 0b896ac commit 132a2ff

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

tests/testthat/test-parallel-outside.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test_that("error outside of test_that()", {
2+
skip_on_covr()
23
withr::local_envvar(TESTTHAT_PARALLEL = "TRUE")
34
err <- tryCatch(
45
capture.output(suppressMessages(testthat::test_local(

tests/testthat/test-parallel-teardown.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("teardown error", {
22
skip("teardown errors are ignored")
3+
skip_on_covr()
34
withr::local_envvar(TESTTHAT_PARALLEL = "TRUE")
45
err <- tryCatch(
56
capture.output(suppressMessages(testthat::test_local(

tests/testthat/test-parallel.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ test_that("good error if bad option", {
2626
})
2727

2828
test_that("ok", {
29+
skip_on_covr()
2930
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE"))
3031
# we cannot run these with the silent reporter, because it is not
3132
# parallel compatible, and they'll not run in parallel
@@ -43,6 +44,7 @@ test_that("ok", {
4344
})
4445

4546
test_that("fail", {
47+
skip_on_covr()
4648
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE"))
4749
# we cannot run these with the silent reporter, because it is not
4850
# parallel compatible, and they'll not run in parallel
@@ -59,6 +61,7 @@ test_that("fail", {
5961
})
6062

6163
test_that("snapshots", {
64+
skip_on_covr()
6265
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE"))
6366
tmp <- withr::local_tempdir("testthat-snap-")
6467
file.copy(test_path("test-parallel", "snap"), tmp, recursive = TRUE)
@@ -81,6 +84,7 @@ test_that("snapshots", {
8184
})
8285

8386
test_that("new snapshots are added", {
87+
skip_on_covr()
8488
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE", CI = "false"))
8589
tmp <- withr::local_tempdir("testthat-snap-")
8690
file.copy(test_path("test-parallel", "snap"), tmp, recursive = TRUE)
@@ -105,6 +109,7 @@ test_that("new snapshots are added", {
105109
})
106110

107111
test_that("snapshots are removed if test file has no snapshots", {
112+
skip_on_covr()
108113
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE"))
109114
tmp <- withr::local_tempdir("testthat-snap-")
110115
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", {
132137
})
133138

134139
test_that("snapshots are removed if test file is removed", {
140+
skip_on_covr()
135141
withr::local_envvar(c(TESTTHAT_PARALLEL = "TRUE"))
136142
withr::defer(unlink(tmp, recursive = TRUE))
137143
dir.create(tmp <- tempfile("testthat-snap-"))

0 commit comments

Comments
 (0)