Skip to content

Commit 417046a

Browse files
authored
Merge branch 'r-lib:main' into feature/desc_filter_improvement
2 parents 84dc618 + acbf9d6 commit 417046a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+535
-97
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
push:
99
branches: [main, master]
1010
pull_request:
11-
branches: [main, master]
1211

1312
name: R-CMD-check.yaml
1413

.github/workflows/pkgdown.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87
release:
98
types: [published]
109
workflow_dispatch:

.github/workflows/test-coverage.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87

98
name: test-coverage.yaml
109

@@ -35,14 +34,16 @@ jobs:
3534
clean = FALSE,
3635
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3736
)
37+
print(cov)
3838
covr::to_cobertura(cov)
3939
shell: Rscript {0}
4040

41-
- uses: codecov/codecov-action@v4
41+
- uses: codecov/codecov-action@v5
4242
with:
43-
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44-
file: ./cobertura.xml
45-
plugin: noop
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
4647
disable_search: true
4748
token: ${{ secrets.CODECOV_TOKEN }}
4849

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ License: MIT + file LICENSE
1515
URL: https://testthat.r-lib.org, https://github.com/r-lib/testthat
1616
BugReports: https://github.com/r-lib/testthat/issues
1717
Depends:
18-
R (>= 3.6.0)
18+
R (>= 4.1.0)
1919
Imports:
2020
brio (>= 1.1.3),
2121
callr (>= 3.7.3),
2222
cli (>= 3.6.1),
2323
desc (>= 1.4.2),
24-
digest (>= 0.6.33),
2524
evaluate (>= 1.0.1),
2625
jsonlite (>= 1.8.7),
2726
lifecycle (>= 1.0.3),
@@ -40,6 +39,7 @@ Suggests:
4039
covr,
4140
curl (>= 0.9.5),
4241
diffviewer (>= 0.1.0),
42+
digest (>= 0.6.33),
4343
knitr,
4444
rmarkdown,
4545
rstudioapi,
@@ -56,4 +56,4 @@ Config/testthat/parallel: true
5656
Config/testthat/start-first: watcher, parallel*
5757
Encoding: UTF-8
5858
Roxygen: list(markdown = TRUE, r6 = FALSE)
59-
RoxygenNote: 7.3.2.9000
59+
RoxygenNote: 7.3.2

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export(expect_s3_class)
119119
export(expect_s4_class)
120120
export(expect_s7_class)
121121
export(expect_setequal)
122+
export(expect_shape)
122123
export(expect_silent)
123124
export(expect_snapshot)
124125
export(expect_snapshot_error)
@@ -189,6 +190,7 @@ export(skip_on_covr)
189190
export(skip_on_cran)
190191
export(skip_on_os)
191192
export(skip_on_travis)
193+
export(skip_unless_r)
192194
export(snapshot_accept)
193195
export(snapshot_review)
194196
export(source_dir)

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# testthat (development version)
22

3+
* `local_edition()` now gives a useful error for bad values (#1547).
4+
* testthat now requires R 4.1.
5+
* `expect_s4_class()` now supports unquoting (@stibu81, #2064).
6+
* `it()` now finds the correct evaluation environment in more cases (@averissimo, #2085).
7+
* Fixed an issue preventing compilation from succeeding due to deprecation / removal of `std::uncaught_exception()` (@kevinushey, #2047).
8+
* New `skip_unless_r()` to skip running tests on unsuitable versions of R, e.g. `skip_unless_r(">= 4.1.0")` to skip tests that require, say, `...names` (@MichaelChirico, #2022)
9+
* `skip_on_os()` gains an option `"emscripten"` of the `os` argument to skip tests on Emscripten (@eitsupi, #2103).
10+
* New expectation, `expect_shape()`, for testing the shape (i.e., the `length()`, `nrow()`, `ncol()`, or `dim()`), all in one place (#1423, @michaelchirico).
11+
312
# testthat 3.2.3
413

514
* Fixed an issue where `expect_no_error(1)` was failing (#2037).

R/describe.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ it <- function(description, code = NULL) {
9494
check_string(description, allow_empty = FALSE)
9595

9696
code <- substitute(code)
97-
describe_it(description, code)
97+
describe_it(description, code, env = parent.frame())
9898
}

R/edition.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ edition_name <- function(x) {
6161
#' @param x Edition Should be a single integer.
6262
#' @param .env Environment that controls scope of changes. For expert use only.
6363
local_edition <- function(x, .env = parent.frame()) {
64-
stopifnot(is_zap(x) || (is.numeric(x) && length(x) == 1))
65-
64+
check_number_whole(x, min = 2, max = 3)
6665
local_bindings(edition = x, .env = the, .frame = .env)
6766
}
6867

R/expect-inheritance.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ expect_s7_class <- function(object, class) {
125125
#' @rdname inheritance-expectations
126126
expect_s4_class <- function(object, class) {
127127
act <- quasi_label(enquo(object), arg = "object")
128-
act_val_lab <- format_class(methods::is(object))
128+
act$class <- format_class(methods::is(act$val))
129129
exp_lab <- format_class(class)
130130

131131
if (identical(class, NA)) {
@@ -139,7 +139,7 @@ expect_s4_class <- function(object, class) {
139139
} else {
140140
expect(
141141
methods::is(act$val, class),
142-
sprintf("%s inherits from %s not %s.", act$lab, act_val_lab, exp_lab)
142+
sprintf("%s inherits from %s not %s.", act$lab, act$class, exp_lab)
143143
)
144144
}
145145
} else {

R/expect-known.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ expect_equal_to_reference <- function(..., update = FALSE) {
191191
#' @param hash Known hash value. Leave empty and you'll be informed what
192192
#' to use in the test output.
193193
expect_known_hash <- function(object, hash = NULL) {
194+
check_installed("digest")
194195
edition_deprecate(3, "expect_known_hash()",
195196
"Please use `expect_snapshot_value()` instead"
196197
)
@@ -215,5 +216,5 @@ expect_known_hash <- function(object, hash = NULL) {
215216
}
216217

217218
all_utf8 <- function(x) {
218-
! any(is.na(iconv(x, "UTF-8", "UTF-8")))
219+
!anyNA(iconv(x, "UTF-8", "UTF-8"))
219220
}

0 commit comments

Comments
 (0)