Skip to content

Commit

Permalink
Migrate up to test-class_local.R
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 4, 2023
1 parent 9e732f1 commit d4c0648
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions tests/testthat/test-class_future.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ tar_test("workerless deployment works", {
pipeline <- pipeline_init(list(x, y, z))
out <- future_init(pipeline)
out$run()
built <- names(out$scheduler$progress$built$envir)
expect_equal(built, character(0))
completed <- names(out$scheduler$progress$completed$envir)
expect_equal(completed, character(0))
})

tar_test("semi-workerless deployment works", {
Expand All @@ -45,8 +45,8 @@ tar_test("semi-workerless deployment works", {
pipeline <- pipeline_init(list(x, y, z))
out <- future_init(pipeline)
out$run()
built <- names(out$scheduler$progress$built$envir)
expect_equal(built, character(0))
completed <- names(out$scheduler$progress$completed$envir)
expect_equal(completed, character(0))
})

tar_test("some targets up to date, some not", {
Expand All @@ -64,7 +64,7 @@ tar_test("some targets up to date, some not", {
pipeline <- pipeline_init(list(x, y))
future <- future_init(pipeline)
future$run()
out <- names(future$scheduler$progress$built$envir)
out <- names(future$scheduler$progress$completed$envir)
expect_equal(out, "y")
value <- target_read_value(pipeline_get_target(pipeline, "y"))
expect_equal(value$object, 2L)
Expand All @@ -87,7 +87,7 @@ tar_test("specialized plans (unstructured resources)", {
pipeline <- pipeline_init(list(x, y))
future <- future_init(pipeline)
future$run()
out <- sort(names(future$scheduler$progress$built$envir))
out <- sort(names(future$scheduler$progress$completed$envir))
expect_equal(out, sort(c("x", "y")))
value <- target_read_value(pipeline_get_target(pipeline, "y"))
expect_equal(value$object, 1L)
Expand All @@ -109,7 +109,7 @@ tar_test("future algo can skip targets", {
pipeline <- pipeline_init(list(x, y))
future <- future_init(pipeline)
future$run()
out <- names(future$scheduler$progress$built$envir)
out <- names(future$scheduler$progress$completed$envir)
expect_equal(out, "x")
value <- target_read_value(pipeline_get_target(pipeline, "x"))
expect_equal(value$object, 1L)
Expand Down Expand Up @@ -156,8 +156,8 @@ tar_test("branching plan", {
expect_equal(skipped, character(0))
out2 <- future_init(pipeline_map(), workers = 2L)
out2$run()
built <- names(out2$scheduler$progress$built$envir)
expect_equal(built, character(0))
completed <- names(out2$scheduler$progress$completed$envir)
expect_equal(completed, character(0))
value <- function(name) {
target_read_value(pipeline_get_target(pipeline, name))$object
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-class_group.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ tar_test("group branch invalidation (#507)", {
})
tar_make(callr_function = NULL)
out <- tar_progress()
out <- out$name[out$progress == "built" & grepl("^y_", out$name)]
out <- out$name[out$progress == "completed" & grepl("^y_", out$name)]
expect_equal(length(out), 1L)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-class_imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ tar_test("imports setting works", {
out <- tar_outdated(callr_function = NULL, targets_only = FALSE)
expect_true(all(c("f", "g", "x") %in% out))
tar_make(callr_function = NULL)
expect_equal(tar_progress(x)$progress, "built")
expect_equal(tar_progress(x)$progress, "completed")
expect_equal(tar_read(x), 3L)
})
12 changes: 6 additions & 6 deletions tests/testthat/test-class_inspection.R
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ tar_test("target vertices get progress", {
)
lines <- c(
"name|progress",
"w|built",
"x|started",
"w|completed",
"x|dispatched",
"y|canceled",
"z|errored"
)
Expand All @@ -278,7 +278,7 @@ tar_test("target vertices get progress", {
exp <- data_frame(
name = c("w", "x", "y", "z"),
type = rep("stem", 4L),
status = c("outdated", "started", "canceled", "errored")
status = c("outdated", "dispatched", "canceled", "errored")
)
exp <- exp[order(exp$name), ]
rownames(vertices) <- NULL
Expand All @@ -299,8 +299,8 @@ tar_test("turn outdated off", {
)
lines <- c(
"name|progress",
"w|built",
"x|started",
"w|completed",
"x|dispatched",
"y|canceled",
"z|errored"
)
Expand All @@ -313,7 +313,7 @@ tar_test("turn outdated off", {
exp <- data_frame(
name = c("w", "x", "y", "z"),
type = rep("stem", 4L),
status = c("built", "started", "canceled", "errored")
status = c("completed", "dispatched", "canceled", "errored")
)
exp <- exp[order(exp$name), ]
rownames(vertices) <- NULL
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-class_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tar_test("can run on a subset of targets", {
pipeline <- pipeline_order()
local <- local_init(pipeline, names = c("min1", "max2"))
local$run()
out <- counter_get_names(local$scheduler$progress$built)
out <- counter_get_names(local$scheduler$progress$completed)
exp <- c("min1", "max2", "data1", "data2")
expect_equal(sort(out), sort(exp))
expect_equal(
Expand Down

0 comments on commit d4c0648

Please sign in to comment.