Skip to content
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

Update standalone files + standardize snapshot tests #1579

Merged
merged 11 commits into from
Oct 25, 2024

Conversation

olivroy
Copy link
Contributor

@olivroy olivroy commented Oct 23, 2024

  • update standalone with usethis::use_standalone("r-lib/rlang")
  • Update snapshot tests to use a single exect_snapshot(error = TRUE) for each error
  • Remove expect_error() inside snapshots as we no longer need the error class
  • replace expect_warning(code, regexp = NA) by expect_no_warning()
  • Require more recent testthat version
  • Used testthat::set_max_fails(Inf) for faster iteration during development

Copy link
Member

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

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

Thanks! A few things to tweak across the board but otherwise looks great

tests/testthat/test-pivot-long.R Show resolved Hide resolved
tests/testthat/test-pivot-long.R Outdated Show resolved Hide resolved
tests/testthat/test-pivot-long.R Outdated Show resolved Hide resolved
tests/testthat/test-unnest-helper.R Show resolved Hide resolved
expect_snapshot((expect_error(unnest(df, x))))
expect_snapshot(unnest(df, x), error = TRUE, cnd_class = TRUE)
Copy link
Member

Choose a reason for hiding this comment

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

I took a look at the updated snapshots. In all cases I believe we can drop cnd_class = TRUE.

Our advice lately is that if you really care about the error class, then you do

testthat::expect_error(class = )

and if you also care about the error message, you do a separate

testthat::expect_snapshot(error = )

But lately we have not been combining both features into a single snapshot

And in all cases here in tidyr I don't think we care about the error class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in b49c272

@olivroy olivroy requested a review from DavisVaughan October 24, 2024 20:20
@DavisVaughan DavisVaughan merged commit 3a9a93c into tidyverse:main Oct 25, 2024
14 checks passed
@DavisVaughan
Copy link
Member

Looks awesome thanks so much!

@olivroy olivroy deleted the stand branch October 25, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants