Skip to content

Commit 956f4f6

Browse files
authored
Advance deprecations (#1874)
1 parent dc9b381 commit 956f4f6

File tree

6 files changed

+16
-51
lines changed

6 files changed

+16
-51
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ S3method(format,expectation)
1414
S3method(format,expectation_success)
1515
S3method(format,mismatch_character)
1616
S3method(format,mismatch_numeric)
17-
S3method(is_informative_error,default)
1817
S3method(output_replay,character)
1918
S3method(output_replay,error)
2019
S3method(output_replay,message)

NEWS.md

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

3+
* `is_informative_error()` and the `wrap` argument to `test_dir()` and friends
4+
are now defunct.
5+
36
* `expect_snapshot_value()` has an improved error if the object can't be
47
safely serialized using the specified `style` (#1771).
58

R/deprec-condition.R

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,25 +141,5 @@ get_messages <- function(x) {
141141
#' @keywords internal
142142
#' @export
143143
is_informative_error <- function(x, ...) {
144-
lifecycle::deprecate_warn("3.0.0", "is_informative_error()")
145-
ellipsis::check_dots_empty()
146-
147-
if (!inherits(x, "error")) {
148-
return(TRUE)
149-
}
150-
151-
if (inherits(x, c("simpleError", "Rcpp::eval_error", "Rcpp::exception"))) {
152-
return(FALSE)
153-
}
154-
155-
if (inherits_only(x, c("rlang_error", "error", "condition"))) {
156-
return(FALSE)
157-
}
158-
159-
UseMethod("is_informative_error")
160-
}
161-
162-
#' @export
163-
is_informative_error.default <- function(x, ...) {
164-
TRUE
144+
lifecycle::deprecate_stop("3.0.0", "is_informative_error()")
165145
}

R/test-files.R

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ test_dir <- function(path,
7070
}
7171

7272
if (!is_missing(wrap)) {
73-
lifecycle::deprecate_warn("3.0.0", "test_dir(wrap = )")
73+
lifecycle::deprecate_stop("3.0.0", "test_dir(wrap = )")
7474
}
7575

7676
want_parallel <- find_parallel(path, load_package, package)
@@ -94,7 +94,6 @@ test_dir <- function(path,
9494
env = env,
9595
stop_on_failure = stop_on_failure,
9696
stop_on_warning = stop_on_warning,
97-
wrap = wrap,
9897
load_package = load_package,
9998
parallel = parallel
10099
)
@@ -150,11 +149,8 @@ test_files <- function(test_dir,
150149
parallel = FALSE,
151150
error_call = caller_env()) {
152151

153-
if (is_missing(wrap)) {
154-
wrap <- TRUE
155-
}
156152
if (!isTRUE(wrap)) {
157-
lifecycle::deprecate_warn("3.0.0", "test_dir(wrap = )")
153+
lifecycle::deprecate_stop("3.0.0", "test_dir(wrap = )")
158154
}
159155

160156
# Must keep these two blocks in sync
@@ -168,7 +164,6 @@ test_files <- function(test_dir,
168164
env = env,
169165
stop_on_failure = stop_on_failure,
170166
stop_on_warning = stop_on_warning,
171-
wrap = wrap,
172167
load_package = load_package
173168
)
174169
} else {
@@ -182,7 +177,6 @@ test_files <- function(test_dir,
182177
stop_on_failure = stop_on_failure,
183178
stop_on_warning = stop_on_warning,
184179
desc = desc,
185-
wrap = wrap,
186180
load_package = load_package,
187181
error_call = error_call
188182
)
@@ -216,7 +210,6 @@ test_files_serial <- function(test_dir,
216210
test_one_file,
217211
env = env,
218212
desc = desc,
219-
wrap = wrap,
220213
error_call = error_call
221214
)
222215
)
@@ -325,7 +318,6 @@ test_files_check <- function(results, stop_on_failure = TRUE, stop_on_warning =
325318
test_one_file <- function(path,
326319
env = test_env(),
327320
desc = NULL,
328-
wrap = TRUE,
329321
error_call = caller_env()) {
330322
reporter <- get_reporter()
331323
on.exit(teardown_run(), add = TRUE)
@@ -334,7 +326,6 @@ test_one_file <- function(path,
334326
source_file(
335327
path,
336328
env = env(env),
337-
wrap = wrap,
338329
desc = desc,
339330
error_call = error_call
340331
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# is_informative_error is defunct
2+
3+
Code
4+
is_informative_error(TRUE)
5+
Condition
6+
Error:
7+
! `is_informative_error()` was deprecated in testthat 3.0.0 and is now defunct.
8+

tests/testthat/test-deprec-condition.R

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
test_that("is_informative_error returns TRUE for basic errors", {
2-
withr::local_options(lifecycle_verbosity = "quiet")
3-
4-
is_informative <- function(x) is_informative_error(catch_cnd(x))
5-
6-
expect_false(is_informative(stop("!")))
7-
expect_false(is_informative(abort("!")))
8-
9-
expect_false(is_informative(abort("!", class = "Rcpp::eval_error")))
10-
expect_false(is_informative(abort("!", class = "Rcpp::exception")))
11-
12-
expect_true(is_informative(abort("!", class = "error_custom")))
13-
14-
with_bindings(
15-
.env = global_env(),
16-
is_informative_error.error_custom = function(...) FALSE,
17-
expect_false(is_informative(abort("!", class = "error_custom")))
18-
)
1+
test_that("is_informative_error is defunct", {
2+
expect_snapshot(is_informative_error(TRUE), error = TRUE)
193
})
204

215
test_that("capture_warnings can ignore deprecation warnings", {

0 commit comments

Comments
 (0)