Skip to content

Add skip_unless_r() - #2094

Merged
hadley merged 21 commits into
r-lib:mainfrom
MichaelChirico:skip-r
Jul 24, 2025
Merged

hadley merged 21 commits into
r-lib:mainfrom
MichaelChirico:skip-r

Conversation

@MichaelChirico

Copy link
Copy Markdown
Contributor

Closes #2022. Feedback welcome.

I decided against an implicit default for the operator like skip_unless_r("4.0.0") being >= or == implicitly. I've also kept a rigid one-space requirement for now, though that's easy to change to strsplit(spec, "\\s*").

@MichaelChirico

Copy link
Copy Markdown
Contributor Author

I don't think the R CMD check issues are related, I'll rebase to a clean main once one is available

@hadley

hadley commented Jul 23, 2025

Copy link
Copy Markdown
Member

Looks like you assumed that a very obvious function should exist 😄

@MichaelChirico

MichaelChirico commented Jul 23, 2025 •

Copy link
Copy Markdown
Contributor Author

haha, oops.

I guess when present the usual thing is to do expect_snapshot_skip, then -- would you prefer that, or adding the simple analogue expect_skip()?

expect_snapshot_skip <- function(x, cran = FALSE) {
expect_snapshot_error(x, class = "skip", cran = cran)
}
expect_no_skip <- function(code) {
expect_no_condition(code, class = "skip")
}

@hadley

hadley commented Jul 23, 2025

Copy link
Copy Markdown
Member

I also tried to use expect_skip() yesterday and was surprised that it didn't exist, so I'd suggest implementing it 😄

Comment thread R/skip.R Resolved
Comment thread tests/testthat/test-skip.R Resolved
Comment thread R/skip.R Resolved
Comment thread NEWS.md Resolved
Comment thread NEWS.md Resolved
@MichaelChirico

Copy link
Copy Markdown
Contributor Author

Hm, I thought it was possible to download the new snapshots from the GHA logs, I guess not. It may take me a few days to get to a machine that I can use to upload the snapshot output FYI.

@hadley

hadley commented Jul 23, 2025

Copy link
Copy Markdown
Member

I can run those for you.

Comment thread tests/testthat/_snaps/skip.md Resolved
Comment thread tests/testthat/test-skip.R Resolved
@hadley
hadley merged commit c7fedf4 into r-lib:main Jul 24, 2025
@hadley

hadley commented Jul 24, 2025

Copy link
Copy Markdown
Member

Thank you!

@MichaelChirico
MichaelChirico deleted the skip-r branch July 24, 2025 13:43
schloerke added a commit to schloerke/testthat that referenced this pull request Jul 25, 2025
* upstream/HEAD: (250 commits)
  Implement `expect_shape()` (r-lib#1469)
  Re-enable catch tests on windows (r-lib#2104)
  Move digest to suggests (r-lib#2105)
  Support emscripten in `skip_on_os()` (r-lib#2103)
  Add `skip_unless_r()` (r-lib#2094)
  Require R 4.1 (r-lib#2101)
  Allow unquoting first arg for `expect_s4_class()` (r-lib#2065)
  typo fix (r-lib#2051)
  Explicitly pass `parent.frame()` in `it()` (r-lib#2086)
  Update vignette advice for migrating to {testthat} 3e (r-lib#2080)
  New praise messages (r-lib#1974)
  move '!' outside aggregation (r-lib#2067)
  Handle deprecation of std::uncaught_exception() (r-lib#2097)
  perf: use `anyNA()` (r-lib#2058)
  Upkeep (r-lib#2099)
  Implement `mock_output_sequence()` (r-lib#2061)
  Increment version number to 3.2.3.9000
  Increment version number to 3.2.3
  Update CRAN comments
  Finish off r-lib#2046
  ...
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.

skip_if_not_r_version()?

2 participants