From 07b84da90d47596347f71aacae5dd0ac4ca8516f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Fri, 8 Mar 2024 08:31:01 +0100 Subject: [PATCH] Fix tests on Windows R 3.6.x magick does not support R 3.6.x any more, so there is no asciicast package. --- .github/workflows/R-CMD-check.yaml | 8 ++++++++ tests/testthat/test-assertions.R | 13 +++++++++++++ tests/testthat/test-assertthat.R | 1 + 3 files changed, 22 insertions(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 4f12df5c..1918f3f6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -54,10 +54,18 @@ jobs: use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 + if: runner.os != 'Windows' with: extra-packages: any::rcmdcheck needs: check + - uses: r-lib/actions/setup-r-dependencies@v2 + if: runner.os == 'Windows' + with: + extra-packages: any::rcmdcheck, asciicast=?ignore-before-r=4.0.0 + needs: check + + - name: "Set environmental variables" run: | cat(paste0("R_USER_CACHE_DIR=", Sys.getenv("GITHUB_WORKSPACE"), "/.github/cache\n"), file = Sys.getenv("GITHUB_ENV"), append = TRUE) diff --git a/tests/testthat/test-assertions.R b/tests/testthat/test-assertions.R index d311631b..adac0344 100644 --- a/tests/testthat/test-assertions.R +++ b/tests/testthat/test-assertions.R @@ -7,6 +7,7 @@ test_that("is_character", { }) test_that("is_character errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( fn <- function(x) assert_that(is_character(x)), fn(1:2), @@ -19,6 +20,7 @@ test_that("is_character errors", { }) test_that("is_character errors, noninteractive", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( interactive = FALSE, fn <- function(x) assert_that(is_character(x)), @@ -57,6 +59,7 @@ test_that("is_string", { }) test_that("is_string errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_string(x)), @@ -76,6 +79,7 @@ test_that("is_optional_string", { }) test_that("is_optional_string errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_optional_string(x)), @@ -93,6 +97,7 @@ test_that("is_flag", { }) test_that("is_flag errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_flag(x)), @@ -110,6 +115,7 @@ test_that("is_path", { }) test_that("is_path errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_path(x)), @@ -128,6 +134,7 @@ test_that("is_optional_path", { }) test_that("is_optional path errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_optional_path(x)), @@ -145,6 +152,7 @@ test_that("all_named", { }) test_that("all_named errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(all_named(x)), @@ -164,6 +172,7 @@ test_that("is_existing_file", { }) test_that("is_existing_file errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = function(x) transform_no_links(transform_show_cursor(x)), fn <- function(x) assert_that(is_existing_file(x)), @@ -181,6 +190,7 @@ test_that("is_platform_list", { }) test_that("is_platform_list errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_platform_list(x)), @@ -201,6 +211,7 @@ test_that("is_dependencies", { }) test_that("is_dependencies errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_dependencies(x)), @@ -218,6 +229,7 @@ test_that("is_r_version_list", { }) test_that("is_r_version_list errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = function(x) transform_show_cursor(transform_no_srcref(x)), fn <- function(x) assert_that(is_r_version_list(x)), @@ -233,6 +245,7 @@ test_that("is_difftime", { }) test_that("is_difftime errors", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = transform_show_cursor, fn <- function(x) assert_that(is_difftime(x)), diff --git a/tests/testthat/test-assertthat.R b/tests/testthat/test-assertthat.R index 3a284181..fd9523ca 100644 --- a/tests/testthat/test-assertthat.R +++ b/tests/testthat/test-assertthat.R @@ -47,6 +47,7 @@ test_that("assertion returns invalid value", { }) test_that("default messages", { + if (is_windows() && getRversion() < "4.0.0") skip("No magick") asciicast::expect_snapshot_r_process( transform = function(x) { transform_no_srcref(transform_no_links(transform_show_cursor(x)))