Skip to content

Commit 4832ed5

Browse files
committed
Don't run compare_figs() on CRAN
1 parent bb6de99 commit 4832ed5

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

R/testthat-ui.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ str_standardise <- function(s, sep = "-") {
169169
}
170170

171171
case_compare <- function(case) {
172+
# Skipping early to avoid running `compare_files()` on machines
173+
# performing sanitizer checks
174+
if (!is_ci()) {
175+
return(new_expectation("Skipping on CRAN", case, "skip", "vdiffr_skip"))
176+
}
177+
172178
equal <- compare_files(case$testcase, normalizePath(case$path))
173179

174180
if (equal) {

tests/mock.Rout.fail

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Environment:
22
- vdiffr-svg-engine: 0.9000
3-
- vdiffr: 0.2.3.9001
3+
- vdiffr: 0.3.0
44
- freetypeharfbuzz: 0.2.5
55

66

@@ -63,23 +63,3 @@ Failed doppelganger: myplot (../figs//myplot.svg)
6363
Mi41Mg==)' />
6464
<defs>
6565

66-
67-
Failed doppelganger: myplot (../figs//myplot.svg)
68-
69-
< before
70-
> after
71-
@@ 50,4 / 50,5 @@
72-
<rect x='641.72' y='401.98' width='20.80' height='118.58' style='stroke-wi
73-
dth: 1.07; stroke: none; stroke-linecap: butt; fill: #595959;' clip-path='
74-
url(#cpMjguMDl8NzE0LjUyfDU0NC4yN3wyMi41Mg==)' />
75-
<rect x='662.52' y='401.98' width='20.80' height='118.58' style='stroke-wi
76-
dth: 1.07; stroke: none; stroke-linecap: butt; fill: #595959;' clip-path='
77-
url(#cpMjguMDl8NzE0LjUyfDU0NC4yN3wyMi41Mg==)' />
78-
> <line x1='417.09' y1='544.27' x2='417.09' y2='22.52' style='stroke-width:
79-
: 1.07; stroke-linecap: butt;' clip-path='url(#cpMjguMDl8NzE0LjUyfDU0NC4yN3w
80-
: yMi41Mg==)' />
81-
<rect x='28.09' y='22.52' width='686.43' height='521.75' style='stroke-wid
82-
th: 1.07; stroke: #333333;' clip-path='url(#cpMjguMDl8NzE0LjUyfDU0NC4yN3wy
83-
Mi41Mg==)' />
84-
<defs>
85-

tests/testthat/test-expectations.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test_that("Mismatches are skipped except on CI and interactively", {
1111
expect_is(failed_result, "expectation_failure")
1212

1313
skipped_result <- subset_results(test_results, "test-failed.R", "mismatches are skipped when NOT_CRAN is unset")[[1]]
14-
expect_match(skipped_result$message, "Figures don't match: myplot.svg\n")
14+
expect_match(skipped_result$message, "Skipping on CRAN")
1515
expect_is(skipped_result, "expectation_skip")
1616
})
1717

@@ -27,6 +27,7 @@ test_that("Doppelgangers pass", {
2727
})
2828

2929
test_that("skip mismatches if vdiffr is stale", {
30+
withr::local_envvar(c(NOT_CRAN = "true"))
3031
mock_dir <- create_mock_pkg("mock-pkg-skip-stale")
3132

3233
mock_test_dir <- file.path(mock_dir, "tests", "testthat")

0 commit comments

Comments
 (0)