|
| 1 | +# we should't run lockfile process multiple times in tests as it starts background process which is not |
| 2 | +# possible to kill once run. It means that background R sessions are being cumulated |
1 | 3 | withr::local_options( |
2 | | - list( |
3 | | - warnPartialMatchDollar = TRUE, |
4 | | - warnPartialMatchArgs = TRUE, |
5 | | - warnPartialMatchAttr = TRUE, |
6 | | - teal.renv.enable = FALSE |
7 | | - ), |
| 4 | + list(teal.renv.enable = FALSE), |
8 | 5 | .local_envir = testthat::teardown_env() |
9 | 6 | ) |
| 7 | + |
| 8 | +# `opts_partial_match_old` is left for exclusions due to partial matching in dependent packages (i.e. not fixable here) |
| 9 | +# it might happen that it is not used right now, but it is left for possible future use |
| 10 | +# use with: `withr::with_options(opts_partial_match_old, { ... })` inside the test |
| 11 | +opts_partial_match_old <- list( |
| 12 | + warnPartialMatchDollar = getOption("warnPartialMatchDollar"), |
| 13 | + warnPartialMatchArgs = getOption("warnPartialMatchArgs"), |
| 14 | + warnPartialMatchAttr = getOption("warnPartialMatchAttr") |
| 15 | +) |
| 16 | +opts_partial_match_new <- list( |
| 17 | + warnPartialMatchDollar = TRUE, |
| 18 | + warnPartialMatchArgs = TRUE, |
| 19 | + warnPartialMatchAttr = TRUE |
| 20 | +) |
| 21 | + |
| 22 | +if (isFALSE(getFromNamespace("on_cran", "testthat")()) && requireNamespace("withr", quietly = TRUE)) { |
| 23 | + withr::local_options( |
| 24 | + opts_partial_match_new, |
| 25 | + .local_envir = testthat::teardown_env() |
| 26 | + ) |
| 27 | +} |
0 commit comments