Skip to content

Commit

Permalink
prevent messy test output from readr columns
Browse files Browse the repository at this point in the history
  • Loading branch information
azimov committed Sep 10, 2024
1 parent 99ce36f commit b59e27f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test-other.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test_that("timeExecutions function", {
)
expectedFilePath <- file.path(temp, "executionTimes.csv")
checkmate::expect_file_exists(expectedFilePath)
result <- readr::read_csv(expectedFilePath)
result <- readr::read_csv(expectedFilePath, col_types = readr::cols())
checkmate::expect_data_frame(result, nrows = 1, ncols = 5)

expect_false(all(is.na(result$startTime)))
Expand All @@ -83,7 +83,7 @@ test_that("timeExecutions function", {
}
)

result <- readr::read_csv(expectedFilePath)
result <- readr::read_csv(expectedFilePath, col_types = readr::cols())
checkmate::expect_data_frame(result, nrows = 2, ncols = 5)

# Parent string
Expand All @@ -97,7 +97,7 @@ test_that("timeExecutions function", {
}
)

result <- readr::read_csv(expectedFilePath)
result <- readr::read_csv(expectedFilePath, col_types = readr::cols())
checkmate::expect_data_frame(result, nrows = 3, ncols = 5)

# custom start/end times
Expand All @@ -110,7 +110,7 @@ test_that("timeExecutions function", {
execTime = "Foo"
)

result <- readr::read_csv(expectedFilePath)
result <- readr::read_csv(expectedFilePath, col_types = readr::cols())
checkmate::expect_data_frame(result, nrows = 4, ncols = 5)

timeExecution(
Expand All @@ -121,7 +121,7 @@ test_that("timeExecutions function", {
start = Sys.time()
)

result <- readr::read_csv(expectedFilePath)
result <- readr::read_csv(expectedFilePath, col_types = readr::cols())
checkmate::expect_data_frame(result, nrows = 5, ncols = 5)
expect_false(all(is.na(result$startTime)))
})
Expand Down

0 comments on commit b59e27f

Please sign in to comment.