From 6eadd776639001d9899eb41be41757065cdcbc1b Mon Sep 17 00:00:00 2001 From: Diego H Date: Wed, 16 Nov 2022 02:08:49 +0100 Subject: [PATCH 1/2] Try covr on windows --- .github/workflows/test-coverage.yaml | 2 +- tests/testthat/test-esp_getTiles.R | 6 +++--- tests/testthat/test-layer_spatraster.R | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 0c3b41cb..be7994ce 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -10,7 +10,7 @@ name: test-coverage jobs: test-coverage: - runs-on: macos-latest + runs-on: windows-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/tests/testthat/test-esp_getTiles.R b/tests/testthat/test-esp_getTiles.R index 212f30e7..32c5b14f 100644 --- a/tests/testthat/test-esp_getTiles.R +++ b/tests/testthat/test-esp_getTiles.R @@ -20,7 +20,7 @@ test_that("tiles online", { # Skip test as tiles sometimes are not available skip_on_cran() - skip_on_ci() + skip_on_os(c("mac", "linux")) skip_if_offline() save_png <- function(code, width = 200, height = 200) { @@ -149,7 +149,7 @@ test_that("tiles masks and crops", { # Skip test as tiles sometimes are not available skip_on_cran() - skip_on_ci() + skip_on_os(c("mac", "linux")) skip_if_offline() poly <- esp_get_ccaa("La Rioja", epsg = 4326) @@ -184,7 +184,7 @@ test_that("tiles options", { # Skip test as tiles sometimes are not available skip_on_cran() - skip_on_ci() + skip_on_os(c("mac", "linux")) skip_if_offline() poly <- esp_get_capimun(munic = "^Toledo", epsg = 3857) diff --git a/tests/testthat/test-layer_spatraster.R b/tests/testthat/test-layer_spatraster.R index 538d6223..a2479b6e 100644 --- a/tests/testthat/test-layer_spatraster.R +++ b/tests/testthat/test-layer_spatraster.R @@ -15,7 +15,6 @@ test_that("Test layers", { # Skip test as tiles sometimes are not available skip_on_cran() - skip_on_ci() skip_if_offline() From d23324c488a80355062c6497f92e2a364a66feda Mon Sep 17 00:00:00 2001 From: Diego H Date: Wed, 16 Nov 2022 02:29:19 +0100 Subject: [PATCH 2/2] Skip point --- tests/testthat/test-esp_getTiles.R | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/testthat/test-esp_getTiles.R b/tests/testthat/test-esp_getTiles.R index 32c5b14f..333be0ac 100644 --- a/tests/testthat/test-esp_getTiles.R +++ b/tests/testthat/test-esp_getTiles.R @@ -69,26 +69,6 @@ test_that("tiles online", { type = "IGNBase.Orto" )) - # Single point - point <- esp_get_ccaa("Madrid") - point <- sf::st_transform(point, 3857) - - point <- sf::st_centroid( - sf::st_geometry(point), - of_largest_polygon = TRUE - ) - - expect_length(point, 1) - expect_s3_class(point, "sfc_POINT") - - expect_message(esp_getTiles(point, - verbose = TRUE - )) - - p <- esp_getTiles(point, verbose = TRUE) - - - expect_message(esp_getTiles(poly, type = "RedTransporte.Carreteras", verbose = TRUE, mask = TRUE @@ -131,6 +111,26 @@ test_that("tiles online", { # Run only locally skip_on_ci() + + # Single point + point <- esp_get_ccaa("Madrid") + point <- sf::st_transform(point, 3857) + + point <- sf::st_centroid( + sf::st_geometry(point), + of_largest_polygon = TRUE + ) + + expect_length(point, 1) + expect_s3_class(point, "sfc_POINT") + + expect_message(esp_getTiles(point, + verbose = TRUE + )) + + p <- esp_getTiles(point, verbose = TRUE) + + expect_snapshot_file(save_png(opaque), "opaque.png") expect_snapshot_file(save_png(n), "transp.png")