Skip to content

Commit 6e0600c

Browse files
committed
Skip more tests on CRAN
1 parent 423bee2 commit 6e0600c

27 files changed

+292
-27
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# targets 0.13.4
22

33
* Implement custom alternative to `skip_on_cran()` to avoid https://github.com/r-lib/testthat/issues/1470#issuecomment-1248145555.
4+
* Skip more tests on CRAN.
45

56
# targets 0.13.3
67

tests/testthat/test-class_builder.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ tar_test("target_run() on a good builder", {
2222
})
2323

2424
tar_test("target_run() on a errored builder", {
25+
skip_cran()
2526
tar_option_set(envir = tmpenv())
2627
local_init(pipeline_init())$start()
2728
x <- target_init(name = "abc", expr = quote(identity(identity(stop(123)))))
@@ -37,6 +38,7 @@ tar_test("target_run() on a errored builder", {
3738
})
3839

3940
tar_test("target_run_worker()", {
41+
skip_cran()
4042
local_init(pipeline_init())$start()
4143
x <- target_init(name = "abc", expr = quote(identity(identity(stop(123)))))
4244
y <- target_run_worker(
@@ -84,6 +86,7 @@ tar_test("read and write objects", {
8486
})
8587

8688
tar_test("error = \"stop\" means stop on error", {
89+
skip_cran()
8790
x <- target_init("x", expr = quote(stop(123)), error = "stop")
8891
y <- target_init("y", expr = quote(stop(456)), error = "stop")
8992
pipeline <- pipeline_init(list(x, y))
@@ -96,6 +99,7 @@ tar_test("error = \"stop\" means stop on error", {
9699
})
97100

98101
tar_test("error = \"continue\" means continue on error", {
102+
skip_cran()
99103
x <- target_init("x", expr = quote(stop(123)), error = "continue")
100104
y <- target_init("y", expr = quote(stop(456)), error = "continue")
101105
pipeline <- pipeline_init(list(x, y))
@@ -114,6 +118,7 @@ tar_test("error = \"continue\" means continue on error", {
114118
})
115119

116120
tar_test("error = \"abridge\" means do not schedule new targets", {
121+
skip_cran()
117122
x <- target_init("x", expr = quote(stop(123)), error = "abridge")
118123
y <- target_init("y", expr = quote(x))
119124
pipeline <- pipeline_init(list(x, y))
@@ -125,6 +130,7 @@ tar_test("error = \"abridge\" means do not schedule new targets", {
125130
})
126131

127132
tar_test("errored targets are not up to date", {
133+
skip_cran()
128134
x <- target_init("x", expr = quote(123))
129135
pipeline <- pipeline_init(list(x))
130136
local_init(pipeline)$run()
@@ -139,6 +145,7 @@ tar_test("errored targets are not up to date", {
139145
})
140146

141147
tar_test("same if we continue on error", {
148+
skip_cran()
142149
x <- target_init("x", expr = quote(123))
143150
pipeline <- pipeline_init(list(x))
144151
local_init(pipeline)$run()
@@ -154,6 +161,7 @@ tar_test("same if we continue on error", {
154161
})
155162

156163
tar_test("builder writing from main", {
164+
skip_cran()
157165
tar_option_set(envir = tmpenv(a = "123"))
158166
local_init(pipeline_init())$start()
159167
x <- target_init("abc", expr = quote(a), format = "rds", storage = "main")
@@ -174,6 +182,7 @@ tar_test("builder writing from main", {
174182
})
175183

176184
tar_test("builder writing from worker", {
185+
skip_cran()
177186
tar_option_set(envir = tmpenv(a = "123"))
178187
local_init(pipeline_init())$start()
179188
x <- target_init(
@@ -198,6 +207,7 @@ tar_test("builder writing from worker", {
198207
})
199208

200209
tar_test("retrieval = \"none\"", {
210+
skip_cran()
201211
skip_cran()
202212
tar_script({
203213
list(
@@ -218,6 +228,7 @@ tar_test("storage = \"none\" errors if user does not write storage", {
218228
})
219229

220230
tar_test("storage = \"none\" ignores return value but tracks file", {
231+
skip_cran()
221232
tar_script({
222233
run_x <- function() {
223234
if (!file.exists("_targets/objects")) {
@@ -276,6 +287,7 @@ tar_test("storage = \"none\" ignores return value but tracks file", {
276287
})
277288

278289
tar_test("dynamic file writing from main", {
290+
skip_cran()
279291
local_init(pipeline_init())$start()
280292
envir <- new.env(parent = environment())
281293
tar_option_set(envir = envir)
@@ -301,6 +313,7 @@ tar_test("dynamic file writing from main", {
301313
})
302314

303315
tar_test("dynamic file has illegal path", {
316+
skip_cran()
304317
x <- target_init(
305318
name = "abc",
306319
expr = quote("a*b"),
@@ -311,6 +324,7 @@ tar_test("dynamic file has illegal path", {
311324
})
312325

313326
tar_test("dynamic file has empty path", {
327+
skip_cran()
314328
x <- target_init(
315329
name = "abc",
316330
expr = quote(NULL),
@@ -321,6 +335,7 @@ tar_test("dynamic file has empty path", {
321335
})
322336

323337
tar_test("dynamic file has missing path value", {
338+
skip_cran()
324339
x <- target_init(
325340
name = "abc",
326341
expr = quote(NA_character_),
@@ -331,6 +346,7 @@ tar_test("dynamic file has missing path value", {
331346
})
332347

333348
tar_test("dynamic file is missing at path", {
349+
skip_cran()
334350
x <- target_init(
335351
name = "abc",
336352
expr = quote("nope"),
@@ -342,6 +358,7 @@ tar_test("dynamic file is missing at path", {
342358
})
343359

344360
tar_test("dynamic file writing from worker", {
361+
skip_cran()
345362
local_init(pipeline_init())$start()
346363
envir <- new.env(parent = environment())
347364
tar_option_set(envir = envir)
@@ -369,6 +386,7 @@ tar_test("dynamic file writing from worker", {
369386
})
370387

371388
tar_test("value kept if storage is local", {
389+
skip_cran()
372390
local_init(pipeline_init())$start()
373391
envir <- new.env(parent = environment())
374392
tar_option_set(envir = envir)
@@ -417,6 +435,7 @@ tar_test("basic progress responses are correct", {
417435
})
418436

419437
tar_test("builders load their packages", {
438+
skip_cran()
420439
x <- target_init(
421440
"x",
422441
quote(tibble(x = "x")),
@@ -432,6 +451,7 @@ tar_test("builders load their packages", {
432451
})
433452

434453
tar_test("relay errors as messages if error is continue", {
454+
skip_cran()
435455
tar_script({
436456
tar_option_set(error = "continue")
437457
list(
@@ -453,13 +473,15 @@ tar_test("relay errors as messages if error is continue", {
453473
})
454474

455475
tar_test("target_needs_worker(builder)", {
476+
skip_cran()
456477
x <- tar_target(y, rep(x, 2), deployment = "worker")
457478
expect_true(target_needs_worker(x))
458479
x <- tar_target(y, rep(x, 2), deployment = "main")
459480
expect_false(target_needs_worker(x))
460481
})
461482

462483
tar_test("bootstrap builder for shortcut", {
484+
skip_cran()
463485
tar_script({
464486
list(
465487
tar_target(w, 1L),
@@ -503,6 +525,7 @@ tar_test("informative error when bootstrap fails", {
503525
})
504526

505527
tar_test("validate with nonmissing file and value", {
528+
skip_cran()
506529
x <- target_init(name = "abc", expr = quote(1L + 1L))
507530
x$value <- value_init(123)
508531
file <- x$store$file

tests/testthat/test-class_clustermq.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tar_test("clustermq$workers", {
44
})
55

66
tar_test("workerless deployment works", {
7+
skip_cran()
78
skip_on_os("windows")
89
skip_on_os("solaris")
910
require_clustermq()
@@ -29,6 +30,7 @@ tar_test("workerless deployment works", {
2930
})
3031

3132
tar_test("semi-workerless deployment works", {
33+
skip_cran()
3234
skip_on_os("windows")
3335
skip_on_os("solaris")
3436
require_clustermq()
@@ -58,6 +60,7 @@ tar_test("semi-workerless deployment works", {
5860
})
5961

6062
tar_test("some targets up to date, some not", {
63+
skip_cran()
6164
skip_on_os("windows")
6265
skip_on_os("solaris")
6366
require_clustermq()

tests/testthat/test-class_future.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tar_test("future$workers", {
44
})
55

66
tar_test("workerless deployment works", {
7+
skip_cran()
78
skip_if_not_installed("future")
89
tar_runtime$set_fun("tar_make_future")
910
on.exit(tar_runtime$unset_fun())
@@ -26,6 +27,7 @@ tar_test("workerless deployment works", {
2627
})
2728

2829
tar_test("semi-workerless deployment works", {
30+
skip_cran()
2931
skip_if_not_installed("future")
3032
tar_runtime$set_fun("tar_make_future")
3133
on.exit(tar_runtime$unset_fun())
@@ -48,6 +50,7 @@ tar_test("semi-workerless deployment works", {
4850
})
4951

5052
tar_test("some targets up to date, some not", {
53+
skip_cran()
5154
skip_if_not_installed("future")
5255
tar_runtime$set_fun("tar_make_future")
5356
on.exit(tar_runtime$unset_fun())
@@ -69,6 +72,7 @@ tar_test("some targets up to date, some not", {
6972
})
7073

7174
tar_test("specialized plans (unstructured resources)", {
75+
skip_cran()
7276
skip_if_not_installed("future")
7377
tar_runtime$set_fun("tar_make_future")
7478
on.exit(tar_runtime$unset_fun())
@@ -188,6 +192,7 @@ tar_test("branching plan", {
188192
})
189193

190194
tar_test("future_value_target() produces target objects", {
195+
skip_cran()
191196
tar_runtime$set_fun("tar_make_future")
192197
on.exit(tar_runtime$unset_fun())
193198
pipeline <- pipeline_init(list(tar_target(x, 1)))

tests/testthat/test-class_keras.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
tar_test("validate keras format", {
2+
skip_cran()
23
skip_if_not_installed("keras")
34
x <- target_init(name = "abc", expr = quote(f()), format = "keras")
45
expect_silent(target_validate(x))
56
})
67

78
tar_test("keras packages", {
9+
skip_cran()
810
x <- tar_target(x, 1, format = "keras")
911
out <- store_get_packages(x$store)
1012
expect_equal(out, "keras")
1113
})
1214

1315
tar_test("does not inherit from tar_external", {
16+
skip_cran()
1417
store <- tar_target(x, "x_value", format = "keras")$store
1518
expect_false(inherits(store, "tar_external"))
1619
})
1720

1821
tar_test("store_row_path()", {
22+
skip_cran()
1923
store <- tar_target(x, "x_value", format = "keras")$store
2024
store$file$path <- "path"
2125
expect_equal(store_row_path(store), NA_character_)
2226
})
2327

2428
tar_test("store_path_from_record()", {
29+
skip_cran()
2530
store <- tar_target(x, "x_value", format = "keras")$store
2631
record <- record_init(name = "x", path = "path", format = "keras")
2732
expect_equal(

tests/testthat/test-class_outdated.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
tar_test("outdated$outdated", {
2+
skip_cran()
23
out <- outdated_init(pipeline_init())
34
expect_silent(counter_validate(out$outdated))
45
})
56

67
tar_test("outdated$is_outdated()", {
8+
skip_cran()
79
out <- outdated_init(pipeline_init(), reporter = "silent")
810
expect_equal(out$is_outdated("x"), FALSE)
911
})
1012

1113
tar_test("outdated$register_outdated()", {
14+
skip_cran()
1215
out <- outdated_init(pipeline_init(), reporter = "silent")
1316
out$register_outdated("x")
1417
expect_equal(out$is_outdated("x"), TRUE)
1518
})
1619

1720
tar_test("counter_validate(outdated)", {
21+
skip_cran()
1822
out <- outdated_init(pipeline_init(), reporter = "silent")
1923
expect_silent(counter_validate(out$outdated))
2024
})
2125

2226
tar_test("full non-branching run", {
27+
skip_cran()
2328
out <- outdated_init(pipeline_order(), reporter = "silent")
2429
out$run()
2530
exp <- sort(pipeline_get_names(pipeline_order()))
@@ -32,6 +37,7 @@ tar_test("full non-branching run", {
3237
})
3338

3439
tar_test("full branching run with forecast reporter", {
40+
skip_cran()
3541
out <- outdated_init(
3642
pipeline_map(),
3743
queue = "sequential",
@@ -52,6 +58,7 @@ tar_test("full branching run with forecast reporter", {
5258
})
5359

5460
tar_test("Outdated is idempotent (no overwriting imports)", {
61+
skip_cran()
5562
envir <- new.env(parent = baseenv())
5663
envir$f <- function(x) x
5764
tar_option_set(envir = envir)
@@ -71,6 +78,7 @@ tar_test("Outdated is idempotent (no overwriting imports)", {
7178
})
7279

7380
tar_test("Update the command of a stem", {
81+
skip_cran()
7482
x <- target_init("x", quote(seq_len(3)))
7583
y <- target_init("y", quote(x), pattern = quote(map(x)))
7684
z <- target_init("z", quote(y), pattern = quote(map(y)))
@@ -92,6 +100,7 @@ tar_test("Update the command of a stem", {
92100
})
93101

94102
tar_test("Update the file of a branch", {
103+
skip_cran()
95104
x <- target_init("x", quote(seq_len(3)))
96105
y <- target_init("y", quote(x), pattern = quote(map(x)))
97106
z <- target_init("z", quote(y), pattern = quote(map(y)))
@@ -119,6 +128,7 @@ tar_test("Update the file of a branch", {
119128
})
120129

121130
tar_test("Update the file of a branch and aggregate", {
131+
skip_cran()
122132
x <- target_init("x", quote(seq_len(3)))
123133
y <- target_init("y", quote(x), pattern = quote(map(x)))
124134
z <- target_init("z", quote(y))
@@ -145,6 +155,7 @@ tar_test("Update the file of a branch and aggregate", {
145155
})
146156

147157
tar_test("Corrupt a branch", {
158+
skip_cran()
148159
x <- target_init("x", quote(seq_len(3)))
149160
y <- target_init("y", quote(x), pattern = quote(map(x)))
150161
z <- target_init("z", quote(y), pattern = quote(map(y)))
@@ -169,6 +180,7 @@ tar_test("Corrupt a branch", {
169180
})
170181

171182
tar_test("Corrupt a branch but turn off the depend cue", {
183+
skip_cran()
172184
x <- target_init("x", quote(seq_len(3)))
173185
y <- target_init("y", quote(x), pattern = quote(map(x)))
174186
z <- target_init("z", quote(y), pattern = quote(map(y)))
@@ -195,6 +207,7 @@ tar_test("Corrupt a branch but turn off the depend cue", {
195207
})
196208

197209
tar_test("Depend on all branches", {
210+
skip_cran()
198211
x <- target_init("x", quote(seq_len(3)))
199212
y <- target_init("y", quote(x), pattern = quote(map(x)))
200213
z <- target_init("z", quote(y))
@@ -218,6 +231,7 @@ tar_test("Depend on all branches", {
218231
})
219232

220233
tar_test("map over a stem with no branches previously", {
234+
skip_cran()
221235
pipeline <- pipeline_init(
222236
list(
223237
target_init("x", quote(seq_len(2))),

0 commit comments

Comments
 (0)