Skip to content

Use CRAN vdiffr #3054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

yutannihilation
Copy link
Member

@yutannihilation yutannihilation commented Jan 3, 2019

Since vdiffr 0.3.0 is released, let's

  • switch vdiffr from the GitHub version to the CRAN version and (Travis already uses CRAN version of vdiffr since this commit: 9f1904d)
  • rely on VDIFFR_RUN_TESTS envvar, which vdiffr checks directly, instead of USE_VDIFFR envvar

Note that it seems still better to check the version of vdiffr since we ignore the installation failure of suggested packages by _R_CHECK_FORCE_SUGGESTS_=false.

@lionel-
Copy link
Member

lionel- commented Jan 3, 2019

It is not necessary to set NOT_CRAN because vdiffr also checks for CI, which is set on both Travis and Appveyor. Also the wrapper in helper-vdiffr might be simplified by setting VDIFFR_RUN_TESTS to override the default behaviour on Travis.

@yutannihilation
Copy link
Member Author

Thanks, I need to learn about vdiffr more...

It is not necessary to set NOT_CRAN because vdiffr also checks for CI, which is set on both Travis and Appveyor.

I set NOT_CRAN because the default value of enable_vdiffr depends on it. But, it sounds like it's better to remove this line and let vdiffr to skip tests on CRAN.

# default is equal to whether NOT_CRAN is true or not
enable_vdiffr <- identical(Sys.getenv("NOT_CRAN"), "true")

@yutannihilation
Copy link
Member Author

Confirmed the visual changes are detected properly with the new settings.

https://travis-ci.org/tidyverse/ggplot2/builds/475155850
https://ci.appveyor.com/project/hadley/ggplot2/builds/21373584

@lionel-
Copy link
Member

lionel- commented Jan 6, 2019

LGTM! But let's wait until Claus has time to take another look, since he worked on the Travis settings last time.

@lionel- lionel- requested a review from clauswilke January 6, 2019 10:59
}
# vdiffr ignores failures when
# - VDIFFR_RUN_TESTS is "false" (on Travis CI with older versions and dev version of R)
# - CI is not set (on CRAN)

# disable vdiffr if version is old
if (!requireNamespace("vdiffr", quietly = TRUE) ||
utils::packageVersion("vdiffr") < "0.2.3.9001") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be < "0.3.0"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this if can be removed entirely.

Copy link
Member Author

@yutannihilation yutannihilation Jan 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, maybe I was too defensive.

@clauswilke
Copy link
Member

Looks good to me to.

@lionel- When vdiffr is disabled, does expect_doppelganger() still execute the plotting code, but just doesn't compare svgs, or does it not even build the plot? I think it would be good to always build the plot, even if svg comparison is switched off.

@lionel-
Copy link
Member

lionel- commented Jan 6, 2019

Yup that's how it works. The SVGs are always generated no matter what, so we still get hard failures when the plot doesn't build properly, and we can still use expect_warning() when we expect plot building to warn.

@yutannihilation
Copy link
Member Author

I removed the if statement, which is not really necessary for now; I added the if for the case when we would come to want to enable vdiffr for older versions of R, where the installation failures of suggested package are ignored (_R_CHECK_FORCE_SUGGESTS_=false) so that the older version of vdiffr might be used. But, this seems unlikely to occur.

@yutannihilation yutannihilation merged commit 9eae13b into tidyverse:master Jan 6, 2019
@yutannihilation yutannihilation deleted the refactor/use-cran-vdiffr branch January 6, 2019 14:34
@yutannihilation
Copy link
Member Author

Thanks for reviewing!

@lock
Copy link

lock bot commented Jul 5, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jul 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants