From 63dce2dc94d7f17d497f13a190790d9eec4d5055 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 28 Sep 2022 10:11:28 -0500 Subject: [PATCH] Allow deprecation warnings to bubble up (#1699) Fixes #1680 --- NEWS.md | 6 + R/deprec-condition.R | 6 +- R/evaluate-promise.R | 6 +- R/expect-condition.R | 16 +- R/expect-no-condition.R | 6 +- man/capture_condition.Rd | 2 +- revdep/README.md | 13 +- revdep/cran.md | 17 ++- revdep/failures.md | 30 ++-- revdep/problems.md | 176 ++++++++++++++++++---- tests/testthat/_snaps/snapshot.md | 16 ++ tests/testthat/test-deprec-condition.R | 10 ++ tests/testthat/test-expect-condition.R | 24 +++ tests/testthat/test-expect-no-condition.R | 10 ++ tests/testthat/test-expect-silent.R | 7 + tests/testthat/test-snapshot.R | 10 ++ 16 files changed, 291 insertions(+), 64 deletions(-) diff --git a/NEWS.md b/NEWS.md index c73388f20..94663a157 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,11 @@ # testthat (development version) +* Deprecation warnings are no longer captured by `expect_warning(code, NA)`, + `expect_no_warning(code)`, or `expect_silent(code)`. This ensures that they + bubble up to the top level so that you can address them (#1680). If you want + to assert that code does not throw a deprecation warning, use + `expect_no_condition(code(), class = "lifecycle_warning_deprecation")`. + * New experimental `expect_no_error()`, `expect_no_warning()`, `expect_no_message()`, and `expect_no_condition()` for asserting the code runs without an error, warning, message, or condition (#1679). diff --git a/R/deprec-condition.R b/R/deprec-condition.R index faf3e4cc7..4066f8047 100644 --- a/R/deprec-condition.R +++ b/R/deprec-condition.R @@ -96,12 +96,16 @@ capture_messages <- function(code) { #' @export #' @rdname capture_condition -capture_warnings <- function(code) { +capture_warnings <- function(code, ignore_deprecation = FALSE) { out <- Stack$new() withCallingHandlers( code, warning = function(condition) { + if (ignore_deprecation && is_deprecation(condition)) { + return() + } + out$push(condition) maybe_restart("muffleWarning") } diff --git a/R/evaluate-promise.R b/R/evaluate-promise.R index 5df179630..a393d0a5c 100644 --- a/R/evaluate-promise.R +++ b/R/evaluate-promise.R @@ -18,8 +18,10 @@ evaluate_promise <- function(code, print = FALSE) { warnings <- Stack$new() handle_warning <- function(condition) { - warnings$push(condition) - maybe_restart("muffleWarning") + if (!is_deprecation(condition)) { + warnings$push(condition) + maybe_restart("muffleWarning") + } } messages <- Stack$new() diff --git a/R/expect-condition.R b/R/expect-condition.R index 8bd4695e2..a9c80c986 100644 --- a/R/expect-condition.R +++ b/R/expect-condition.R @@ -167,7 +167,7 @@ expect_warning <- function(object, trace_env = caller_env() ) } else { - act <- quasi_capture(enquo(object), label, capture_warnings) + act <- quasi_capture(enquo(object), label, capture_warnings, ignore_deprecation = identical(regexp, NA)) msg <- compare_messages( act$cap, act$lab, regexp = regexp, all = all, ..., cond_type = "warnings" @@ -229,6 +229,7 @@ expect_condition <- function(object, trace_env = caller_env() ) } else { + act <- quasi_capture(enquo(object), label, capture_condition, entrace = TRUE) msg <- compare_condition_2e( act$cap, @@ -260,7 +261,8 @@ expect_condition_matching <- function(base_class, class %||% base_class, regexp, ..., - inherit = inherit + inherit = inherit, + ignore_deprecation = base_class == "warning" && identical(regexp, NA) ) act <- quasi_capture( @@ -284,7 +286,7 @@ expect_condition_matching <- function(base_class, # ------------------------------------------------------------------------- -cnd_matcher <- function(class, pattern = NULL, ..., inherit = TRUE) { +cnd_matcher <- function(class, pattern = NULL, ..., inherit = TRUE, ignore_deprecation = FALSE) { if (!is_string(class)) { abort("`class` must be a single string") } @@ -297,6 +299,10 @@ cnd_matcher <- function(class, pattern = NULL, ..., inherit = TRUE) { cnd$parent <- NULL } + if (ignore_deprecation && is_deprecation(cnd)) { + return(FALSE) + } + if (is.null(pattern) || isNA(pattern)) { cnd_inherits(cnd, class) } else { @@ -305,6 +311,10 @@ cnd_matcher <- function(class, pattern = NULL, ..., inherit = TRUE) { } } +is_deprecation <- function(x) { + inherits(x, "lifecycle_warning_deprecated") +} + cnd_inherits <- function(cnd, class) { cnd_some(cnd, ~ inherits(.x, class)) } diff --git a/R/expect-no-condition.R b/R/expect-no-condition.R index 3833000fe..d7b167456 100644 --- a/R/expect-no-condition.R +++ b/R/expect-no-condition.R @@ -89,7 +89,11 @@ expect_no_ <- function(base_class, class = NULL, error_call = caller_env()) { - matcher <- cnd_matcher(class %||% base_class, regexp) + matcher <- cnd_matcher( + class %||% base_class, + pattern = regexp, + ignore_deprecation = base_class == "warning" && is.null(regexp) && is.null(class) + ) capture <- function(code) { try_fetch( diff --git a/man/capture_condition.Rd b/man/capture_condition.Rd index 53227d0e7..2f65cce40 100644 --- a/man/capture_condition.Rd +++ b/man/capture_condition.Rd @@ -22,7 +22,7 @@ capture_warning(code, entrace = FALSE) capture_messages(code) -capture_warnings(code) +capture_warnings(code, ignore_deprecation = FALSE) } \arguments{ \item{code}{Code to evaluate} diff --git a/revdep/README.md b/revdep/README.md index 46c7c1d0b..ed4582339 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -5,7 +5,7 @@ |package |version |error |warning |note | |:------------|:-------|:-----|:-------|:----| |Boom |0.9.10 |1 | | | -|bsts |? | | | | +|CausalImpact |? | | | | |NA |? | | | | |ctsem |3.7.1 |1 | | | |NA |? | | | | @@ -34,12 +34,15 @@ |vivid |? | | | | |NA |? | | | | -## New problems (4) +## New problems (7) -|package |version |error |warning |note | -|:--------|:-------|:------|:-------|:----| +|package |version |error |warning |note | +|:----------|:-------|:------|:-------|:----| +|[batata](problems.md#batata)|0.2.1 |__+1__ | |1 | |[brew](problems.md#brew)|1.0-7 |__+1__ | | | |[freshr](problems.md#freshr)|1.0.1 |__+1__ | | | -|[lightgbm](problems.md#lightgbm)|3.3.2 |__+1__ | |1 | +|[log4r](problems.md#log4r)|0.4.2 |__+1__ | | | +|[r2dii.plot](problems.md#r2diiplot)|0.3.0 |__+1__ | | | +|[reprex](problems.md#reprex)|2.0.2 |__+1__ | | | |[WeMix](problems.md#wemix)|3.2.2 |__+1__ |1 | | diff --git a/revdep/cran.md b/revdep/cran.md index 2630ee43b..7fdb01860 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,8 +1,8 @@ ## revdepcheck results -We checked 7102 reverse dependencies (7089 from CRAN + 13 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. +We checked 7109 reverse dependencies (7096 from CRAN + 13 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. - * We saw 4 new problems + * We saw 7 new problems * We failed to check 16 packages Issues with CRAN packages are summarised below. @@ -10,13 +10,22 @@ Issues with CRAN packages are summarised below. ### New problems (This reports the first line of each new failure) +* batata + checking tests ... ERROR + * brew checking tests ... ERROR * freshr checking tests ... ERROR -* lightgbm +* log4r + checking tests ... ERROR + +* r2dii.plot + checking tests ... ERROR + +* reprex checking tests ... ERROR * WeMix @@ -25,7 +34,7 @@ Issues with CRAN packages are summarised below. ### Failed to check * Boom (NA) -* bsts (NA) +* CausalImpact (NA) * ctsem (NA) * elbird (NA) * ggPMX (NA) diff --git a/revdep/failures.md b/revdep/failures.md index 9bfc30ddc..b91bbf3d3 100644 --- a/revdep/failures.md +++ b/revdep/failures.md @@ -76,17 +76,17 @@ ERROR: compilation failed for package ‘Boom’ ``` -# bsts +# CausalImpact
-* Version: 0.9.8 +* Version: 1.2.7 * GitHub: NA -* Source code: https://github.com/cran/bsts -* Date/Publication: 2022-05-30 07:00:12 UTC -* Number of recursive dependencies: 37 +* Source code: https://github.com/cran/CausalImpact +* Date/Publication: 2021-06-07 06:40:02 UTC +* Number of recursive dependencies: 73 -Run `cloud_details(, "bsts")` for more info +Run `cloud_details(, "CausalImpact")` for more info
@@ -95,17 +95,16 @@ Run `cloud_details(, "bsts")` for more info ### Devel ``` -* using log directory ‘/tmp/workdir/bsts/new/bsts.Rcheck’ +* using log directory ‘/tmp/workdir/CausalImpact/new/CausalImpact.Rcheck’ * using R version 4.1.1 (2021-08-10) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-manual’ -* checking for file ‘bsts/DESCRIPTION’ ... OK -* this is package ‘bsts’ version ‘0.9.8’ -* package encoding: UTF-8 +* checking for file ‘CausalImpact/DESCRIPTION’ ... OK +* this is package ‘CausalImpact’ version ‘1.2.7’ * checking package namespace information ... OK * checking package dependencies ... ERROR -Packages required but not available: 'BoomSpikeSlab', 'Boom' +Packages required but not available: 'bsts', 'Boom' See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’ manual. @@ -120,17 +119,16 @@ Status: 1 ERROR ### CRAN ``` -* using log directory ‘/tmp/workdir/bsts/old/bsts.Rcheck’ +* using log directory ‘/tmp/workdir/CausalImpact/old/CausalImpact.Rcheck’ * using R version 4.1.1 (2021-08-10) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-manual’ -* checking for file ‘bsts/DESCRIPTION’ ... OK -* this is package ‘bsts’ version ‘0.9.8’ -* package encoding: UTF-8 +* checking for file ‘CausalImpact/DESCRIPTION’ ... OK +* this is package ‘CausalImpact’ version ‘1.2.7’ * checking package namespace information ... OK * checking package dependencies ... ERROR -Packages required but not available: 'BoomSpikeSlab', 'Boom' +Packages required but not available: 'bsts', 'Boom' See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’ manual. diff --git a/revdep/problems.md b/revdep/problems.md index 393be2aae..1831b3ad9 100644 --- a/revdep/problems.md +++ b/revdep/problems.md @@ -1,3 +1,48 @@ +# batata + +
+ +* Version: 0.2.1 +* GitHub: https://github.com/feddelegrand7/batata +* Source code: https://github.com/cran/batata +* Date/Publication: 2021-03-08 09:50:02 UTC +* Number of recursive dependencies: 62 + +Run `cloud_details(, "batata")` for more info + +
+ +## Newly broken + +* checking tests ... ERROR + ``` + Running ‘testthat.R’ + Running the tests in ‘tests/testthat.R’ failed. + Last 13 lines of output: + + ══ Failed tests ════════════════════════════════════════════════════════════════ + ── Failure ('test-display_starred.R:8'): display_starred() returns a character vector ── + `output` has type 'NULL', not 'character'. + ── Failure ('test-display_starred.R:14'): display_starred() returns a vector + of length superior than 0 ── + length(output) is not strictly more than 0. Difference: 0 + ── Failure ('test-display_starred.R:20'): display_starred() returns a coherent length ── + length(output2) not equal to 10. + 1/1 mismatches + [1] 0 - 10 == -10 + + [ FAIL 3 | WARN 0 | SKIP 1 | PASS 38 ] + Error: Test failures + Execution halted + ``` + +## In both + +* checking LazyData ... NOTE + ``` + 'LazyData' is specified without a 'data' directory + ``` + # brew
@@ -66,7 +111,7 @@ Run `cloud_details(, "freshr")` for more info > library(freshr) > > test_check("freshr") - Test passed 😸 + Test passed 😀 [ FAIL 0 | WARN 0 | SKIP 0 | PASS 1 ] Error in teardown_env() : `teardown_env()` has not been initialized ℹ This is an internal error that was detected in the testthat package. @@ -75,17 +120,55 @@ Run `cloud_details(, "freshr")` for more info Execution halted ``` -# lightgbm +# log4r + +
+ +* Version: 0.4.2 +* GitHub: https://github.com/johnmyleswhite/log4r +* Source code: https://github.com/cran/log4r +* Date/Publication: 2021-11-04 05:20:02 UTC +* Number of recursive dependencies: 65 + +Run `cloud_details(, "log4r")` for more info + +
+ +## Newly broken + +* checking tests ... ERROR + ``` + Running ‘run-all.R’ + Running the tests in ‘tests/run-all.R’ failed. + Last 13 lines of output: + Backtrace: + ▆ + 1. ├─testthat::expect_silent(appender("INFO", "Message")) at test-appenders.R:20:2 + 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise) + 3. │ ├─testthat (local) .capture(...) + 4. │ │ ├─withr::with_output_sink(...) + 5. │ │ │ └─base::force(code) + 6. │ │ ├─base::withCallingHandlers(...) + 7. │ │ └─base::withVisible(code) + 8. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) + 9. └─log4r (local) appender("INFO", "Message") + + [ FAIL 1 | WARN 0 | SKIP 2 | PASS 81 ] + Error: Test failures + Execution halted + ``` + +# r2dii.plot
-* Version: 3.3.2 -* GitHub: https://github.com/Microsoft/LightGBM -* Source code: https://github.com/cran/lightgbm -* Date/Publication: 2022-01-14 13:12:42 UTC -* Number of recursive dependencies: 34 +* Version: 0.3.0 +* GitHub: https://github.com/2DegreesInvesting/r2dii.plot +* Source code: https://github.com/cran/r2dii.plot +* Date/Publication: 2022-05-05 23:20:10 UTC +* Number of recursive dependencies: 91 -Run `cloud_details(, "lightgbm")` for more info +Run `cloud_details(, "r2dii.plot")` for more info
@@ -93,33 +176,64 @@ Run `cloud_details(, "lightgbm")` for more info * checking tests ... ERROR ``` + Running ‘spelling.R’ Running ‘testthat.R’ Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: + `plot_techmix(example_tech_mix())` did not generate error with class 'warning' + Backtrace: + ▆ + 1. └─testthat::expect_snapshot_error(...) at test-plot_techmix.R:296:2 + 2. └─testthat:::expect_snapshot_condition(...) + ── Failure ('test-plot_trajectory.R:204'): throws expected warning about API change ── + `plot_trajectory(example_market_share())` did not generate error with class 'warning' + Backtrace: + ▆ + 1. └─testthat::expect_snapshot_error(...) at test-plot_trajectory.R:204:2 + 2. └─testthat:::expect_snapshot_condition(...) - 71. Feature penalties work properly ('test_parameters.R:14') - lgb.train: Found the following passed through '...': num_leaves, learning_rate, objective, feature_penalty, metric. These will be used, but in future releases of lightgbm, this warning will become an error. Add these to 'params' instead. See ?lgb.train for documentation on how to call this function. - - 72. Feature penalties work properly ('test_parameters.R:14') - lgb.train: Found the following passed through '...': num_leaves, learning_rate, objective, feature_penalty, metric. These will be used, but in future releases of lightgbm, this warning will become an error. Add these to 'params' instead. See ?lgb.train for documentation on how to call this function. - - 73. Feature penalties work properly ('test_parameters.R:14') - lgb.train: Found the following passed through '...': num_leaves, learning_rate, objective, feature_penalty, metric. These will be used, but in future releases of lightgbm, this warning will become an error. Add these to 'params' instead. See ?lgb.train for documentation on how to call this function. - - ══ Failed ══════════════════════════════════════════════════════════════════════ - ── 1. Failure ('test_lgb.Booster.R:474'): Booster$eval() should work on a Datase - `eval_in_mem` not identical to `eval_from_file`. - Objects equal but not identical - - ══ DONE ════════════════════════════════════════════════════════════════════════ + [ FAIL 3 | WARN 3 | SKIP 43 | PASS 103 ] Error: Test failures Execution halted ``` -## In both +# reprex + +
+ +* Version: 2.0.2 +* GitHub: https://github.com/tidyverse/reprex +* Source code: https://github.com/cran/reprex +* Date/Publication: 2022-08-17 07:40:05 UTC +* Number of recursive dependencies: 81 -* checking installed package size ... NOTE +Run `cloud_details(, "reprex")` for more info + +
+ +## Newly broken + +* checking tests ... ERROR ``` - installed size is 82.4Mb - sub-directories of 1Mb or more: - libs 81.8Mb + Running ‘spelling.R’ + Running ‘testthat.R’ + Running the tests in ‘tests/testthat.R’ failed. + Last 13 lines of output: + + ══ Skipped tests ═══════════════════════════════════════════════════════════════ + • On CRAN (65) + + ══ Failed tests ════════════════════════════════════════════════════════════════ + ── Failure ('test-utils-io.R:16'): retrofit_files() works ────────────────────── + `x <- retrofit_files(wd = "this", outfile = "that")` did not generate warning + Backtrace: + ▆ + 1. └─testthat::expect_snapshot_warning(...) at test-utils-io.R:16:2 + 2. └─testthat:::expect_snapshot_condition(...) + + [ FAIL 1 | WARN 1 | SKIP 65 | PASS 63 ] + Error: Test failures + Execution halted ``` # WeMix @@ -150,10 +264,10 @@ Run `cloud_details(, "WeMix")` for more info ══ Failed tests ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ ── Failure ('test-1-main.R:111'): Agrees with lme4 3,handles missing data ────── unname(wm2$vars) not equal to unname(lmewm2vars)^2. - 3/3 mismatches (average diff: 0.0235) - [1] 583.6 - 583.5 == 0.06607 - [2] 33.3 - 33.3 == -0.00220 - [3] 657.2 - 657.2 == -0.00231 + 3/3 mismatches (average diff: 0.0369) + [1] 582.9 - 583.0 == -0.101022 + [2] 33.8 - 33.8 == 0.000533 + [3] 656.5 - 656.5 == 0.009146 [ FAIL 1 | WARN 0 | SKIP 12 | PASS 89 ] Error: Test failures @@ -172,8 +286,8 @@ Run `cloud_details(, "WeMix")` for more info Cross release updates are only supported with update-tlmgr-latest(.sh/.exe) --update See https://tug.org/texlive/upgrade.html for details. - - tlmgr: Local TeX Live (2021) is older than remote repository (2022). + Warning in system2("tlmgr", args, ...) : + running command ''tlmgr' search --file --global '/colortbl.sty'' had status 1 ... Error: processing vignette 'Weighted_Linear_Mixed_Effects_Models.Rmd' failed with diagnostics: LaTeX failed to compile /tmp/workdir/WeMix/new/WeMix.Rcheck/vign_test/WeMix/vignettes/Weighted_Linear_Mixed_Effects_Models.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Weighted_Linear_Mixed_Effects_Models.log for more info. diff --git a/tests/testthat/_snaps/snapshot.md b/tests/testthat/_snaps/snapshot.md index 5896a4c13..2f5ec1570 100644 --- a/tests/testthat/_snaps/snapshot.md +++ b/tests/testthat/_snaps/snapshot.md @@ -96,6 +96,22 @@ This is a warning +# snapshot captures deprecations + + Code + foo() + Condition + Warning: + `foo()` was deprecated in testthat 1.0.0. + +--- + + `foo()` was deprecated in testthat 1.0.0. + +--- + + `foo()` was deprecated in testthat 1.0.0. + # can check error/warning classes Code diff --git a/tests/testthat/test-deprec-condition.R b/tests/testthat/test-deprec-condition.R index eb784524a..9c5cea0ba 100644 --- a/tests/testthat/test-deprec-condition.R +++ b/tests/testthat/test-deprec-condition.R @@ -17,3 +17,13 @@ test_that("is_informative_error returns TRUE for basic errors", { expect_false(is_informative(abort("!", class = "error_custom"))) ) }) + +test_that("capture_warnings can ignore deprecation warnings", { + foo <- function() { + lifecycle::deprecate_warn("1.0.0", "foo()") + } + expect_warning( + expect_equal(capture_warnings(foo(), TRUE), character()), + class = "lifecycle_warning_deprecated" + ) +}) diff --git a/tests/testthat/test-expect-condition.R b/tests/testthat/test-expect-condition.R index 5c15c83e4..db6361a14 100644 --- a/tests/testthat/test-expect-condition.R +++ b/tests/testthat/test-expect-condition.R @@ -86,6 +86,30 @@ test_that("can silence warnings", { withr::with_options(c(warn = -1), warning("foo")) }) +test_that("when checking for no warnings, exclude deprecation warnings", { + foo <- function() { + lifecycle::deprecate_warn("1.0.0", "foo()") + } + expect_warning( + expect_warning(foo(), NA), + class = "lifecycle_warning_deprecated" + ) +}) + +test_that("when checking for no warnings, exclude deprecation warnings (2e)", { + local_edition(2) + + foo <- function() { + options(lifecycle_verbosity = "warning") + lifecycle::deprecate_warn("1.0.0", "foo()") + } + + expect_warning( + expect_warning(foo(), NA), + class = "lifecycle_warning_deprecated" + ) +}) + # expect_message ---------------------------------------------------------- test_that("regexp = NA checks for absence of message", { diff --git a/tests/testthat/test-expect-no-condition.R b/tests/testthat/test-expect-no-condition.R index 1d793094a..f01002477 100644 --- a/tests/testthat/test-expect-no-condition.R +++ b/tests/testthat/test-expect-no-condition.R @@ -24,3 +24,13 @@ test_that("matched conditions give informative message", { expect_no_warning(foo(), message = "problem", class = "test") }) }) + +test_that("deprecations always bubble up", { + foo <- function() { + lifecycle::deprecate_warn("1.0.0", "foo()") + } + expect_warning( + expect_no_warning(foo()), + class = "lifecycle_warning_deprecated" + ) +}) diff --git a/tests/testthat/test-expect-silent.R b/tests/testthat/test-expect-silent.R index 6cf762767..2c3e0c7d7 100644 --- a/tests/testthat/test-expect-silent.R +++ b/tests/testthat/test-expect-silent.R @@ -9,3 +9,10 @@ test_that("checks for any type of output", { test_that("returns first argument", { expect_equal(expect_silent(1), 1) }) + +test_that("deprecations are ignored", { + foo <- function() { + lifecycle::deprecate_warn("1.0.0", "foo()") + } + expect_success(expect_silent(foo)) +}) diff --git a/tests/testthat/test-snapshot.R b/tests/testthat/test-snapshot.R index 6d5c4329e..0e65e522b 100644 --- a/tests/testthat/test-snapshot.R +++ b/tests/testthat/test-snapshot.R @@ -63,6 +63,16 @@ test_that("can capture error/warning messages", { expect_snapshot_warning(warning("This is a warning")) }) +test_that("snapshot captures deprecations", { + foo <- function() { + lifecycle::deprecate_warn("1.0.0", "foo()") + } + + expect_snapshot(foo()) + expect_snapshot_warning(foo()) + expect_snapshot_warning(foo(), class = "lifecycle_warning_deprecated") +}) + test_that("can check error/warning classes", { expect_snapshot(expect_snapshot_error(1), error = TRUE) expect_snapshot(expect_snapshot_error(1, class = "myerror"), error = TRUE)