Skip to content

R CMD check failure #188

@Andrew-Acker125

Description

@Andrew-Acker125

We've been running R CMD check on packages for our package registry manager PRISM (Home | PRISM) and noticed that ggformula is failing during tests with 7 failures. This could be related to a newer version of ggplot2 as we've seen similar snapshot failures in other packages.

The full error output:

checking tests Running testthat.R
Running the tests in tests/testthat.R failed.
Last 13 lines of output:
 1. ggformula:::wrapped_expect_doppelganger(...) at test-layer-factory.R:972:3
 2. vdiffr::expect_doppelganger(title, fig, ...)
 3. base::withCallingHandlers(...)
 4. testthat::expect_snapshot_file(...)

 Snapshots

 To review and process snapshots locally:
 * Locate check directory.
 * Copy 'tests/testthat/_snaps' to local package.
 * Run `testthat::snapshot_accept()` to accept all changes.
 * Run `testthat::snapshot_review()` to review all changes.
[ FAIL 7 | WARN 3 | SKIP 0 | PASS 118 ]
Error: ! Test failures. Execution halted

All 7 failures are vdiffr::expect_doppelganger visual snapshot tests in test-layer-factory.R.
The failing tests:

test_that("gf_contour(), gf_density2d(), and gf_density_2d()", {
  wrapped_expect_doppelganger(
    "gf_countour1",
    gf_point(eruptions ~ waiting, data = faithful) |>
      gf_contour(density ~ waiting + eruptions, data = faithfuld)
  )
  wrapped_expect_doppelganger(
    "gf_density2d2",
    gf_point(eruptions ~ waiting, data = faithful) |>
      gf_density2d(eruptions ~ waiting, data = faithful)
  )
  wrapped_expect_doppelganger(
    "gf_density_2d",
    gf_point(eruptions ~ waiting, data = faithful) |>
      gf_density_2d(eruptions ~ waiting, data = faithful)
  )
})

test_that("gf_contour(), gf_density_2d(), gf_density2d()", {
  wrapped_expect_doppelganger(
    "gf_contour1",
    gf_density_2d(
      eruptions ~ waiting,
      data = faithful,
      alpha = 0.5,
      color = "navy"
    ) |>
      gf_contour(
        density ~ eruptions + waiting,
        data = faithfuld,
        bins = 10,
        color = "red"
      )
  )
})

test_that("gf_fun2d()", {
  wrapped_expect_doppelganger(
    "gf_fun2d1",
    gf_function_2d(
      fun = function(x, y) sin(2 * x * y),
      xlim = c(-pi, pi),
      ylim = c(-pi, pi)
    ) |>
      gf_refine(scale_fill_viridis_c())
  )
})

test_that("gf_raster(), gf_tile(), gf_density2d()", {
  wrapped_expect_doppelganger(
    "gf_tile1",
    gf_tile(density ~ eruptions + waiting, data = faithfuld) |>
      gf_contour(
        density ~ eruptions + waiting,
        color = "yellow",
        inherit = FALSE
      ) |>
      gf_refine(scale_fill_viridis_c(begin = 0.2))
  )
  wrapped_expect_doppelganger(
    "gf_density2d1",
    gf_density2d(eruptions ~ waiting, data = faithful)
  )
})

The expected vs actual SVGs can be found here:

ggformula.zip

This doesn't appear to be a functional issue, the plots look visually identical, but wanted to flag for visibility. Happy to provide any more details or clarity if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions