Skip to content

Commit

Permalink
options for strict tests; few enhancements (#193)
Browse files Browse the repository at this point in the history
- part of
insightsengineering/coredev-tasks#478
- please read this for more info about the implementation:
insightsengineering/coredev-tasks#478 (comment)
- added more excludes in spelling hook
- removed unnecessary empty first line in examples as this is actually
being rendered

Please review the changes carefully and let me know if there is
something you don't like.

---------

Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
  • Loading branch information
pawelru and dependabot-preview[bot] authored Feb 28, 2024
1 parent 126eb2a commit 3647903
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ repos:
(.*/|)\.Rprofile|
(.*/|)\.travis\.y[a]?ml|
(.*/|)appveyor\.y[a]?ml|
(.*/|)CODEOWNERS|
(.*/|)DESCRIPTION|
(.*/|)LICENSE|
(.*/|)NAMESPACE|
(.*/|)staged_dependencies\.y[a]?ml|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ Imports:
Suggests:
dplyr (>= 1.0.0),
knitr (>= 1.42),
lifecycle (>= 0.2.0),
lifecycle (>= 0.2.0),
stringi (>= 1.6),
testthat (>= 3.0.4)
testthat (>= 3.0.4),
withr (>= 2.0.0)
VignetteBuilder:
knitr
Config/Needs/verdepcheck: insightsengineering/formatters,
tidyverse/tibble, mllg/checkmate, tidyverse/dplyr, yihui/knitr,
r-lib/lifecycle, r-lib/testthat
r-lib/lifecycle, gogolewski/stringi, r-lib/testthat, r-lib/withr
Config/Needs/website: insightsengineering/nesttemplate
Config/testthat/edition: 3
Encoding: UTF-8
Expand Down
1 change: 0 additions & 1 deletion R/listing_export.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#'
#' @export
#' @examples
#'
#' dat <- ex_adae
#' lsting <- as_listing(dat[1:25, ], key_cols = c("USUBJID", "AESOC")) %>%
#' add_listing_col("AETOXGR") %>%
Expand Down
1 change: 0 additions & 1 deletion R/rlistings_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ setMethod(
#' the relevant element of the listing updated.
#'
#' @examples
#'
#' lsting <- as_listing(mtcars)
#' main_title(lsting) <- "Hi there"
#'
Expand Down
1 change: 0 additions & 1 deletion man/listing_methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions tests/testthat/setup-options.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `opts_partial_match_old` is left for exclusions due to partial matching in dependent packages (i.e. not fixable here)
# it might happen that it is not used right now, but it is left for possible future use
# use with: `withr::with_options(opts_partial_match_old, { ... })` inside the test
opts_partial_match_old <- list(
warnPartialMatchDollar = getOption("warnPartialMatchDollar"),
warnPartialMatchArgs = getOption("warnPartialMatchArgs"),
warnPartialMatchAttr = getOption("warnPartialMatchAttr")
)
opts_partial_match_new <- list(
warnPartialMatchDollar = TRUE,
warnPartialMatchArgs = TRUE,
warnPartialMatchAttr = TRUE
)

if (isFALSE(getFromNamespace("on_cran", "testthat")()) && requireNamespace("withr", quietly = TRUE)) {
withr::local_options(
opts_partial_match_new,
.local_envir = testthat::teardown_env()
)
}

0 comments on commit 3647903

Please sign in to comment.