Binary files /tmp/tmpextd351q/w2jZO6KGxf/r-cran-devtools-2.4.4/build/vignette.rds and /tmp/tmpextd351q/GSlrdRrmfT/r-cran-devtools-2.4.5/build/vignette.rds differ diff -Nru r-cran-devtools-2.4.4/debian/changelog r-cran-devtools-2.4.5/debian/changelog --- r-cran-devtools-2.4.4/debian/changelog 2022-08-19 12:49:56.000000000 +0000 +++ r-cran-devtools-2.4.5/debian/changelog 2022-10-15 08:57:12.000000000 +0000 @@ -1,3 +1,11 @@ +r-cran-devtools (2.4.5-1) unstable; urgency=medium + + * Team Upload. + * New upstream version 2.4.5 + * Run dh-update-R + + -- Nilesh Patra Sat, 15 Oct 2022 14:27:12 +0530 + r-cran-devtools (2.4.4-1) unstable; urgency=medium * Team Upload. diff -Nru r-cran-devtools-2.4.4/debian/control r-cran-devtools-2.4.5/debian/control --- r-cran-devtools-2.4.4/debian/control 2022-08-19 12:49:30.000000000 +0000 +++ r-cran-devtools-2.4.5/debian/control 2022-10-15 08:56:53.000000000 +0000 @@ -17,18 +17,18 @@ r-cran-memoise (>= 2.0.1), r-cran-miniui, r-cran-pkgbuild (>= 1.3.1), + r-cran-pkgdown, r-cran-pkgload (>= 1.3.0), + r-cran-profvis, r-cran-rcmdcheck (>= 1.4.0), r-cran-remotes (>= 2.4.2), r-cran-rlang (>= 1.0.4), r-cran-roxygen2 (>= 7.2.1), r-cran-rversions (>= 2.1.1), r-cran-sessioninfo (>= 1.2.2), - r-cran-testthat (>= 3.1.4), - r-cran-withr (>= 2.5.0), - r-cran-pkgdown, - r-cran-profvis, - r-cran-urlchecker + r-cran-testthat (>= 3.1.5), + r-cran-urlchecker, + r-cran-withr (>= 2.5.0) Standards-Version: 4.6.1 Vcs-Browser: https://salsa.debian.org/r-pkg-team/r-cran-devtools Vcs-Git: https://salsa.debian.org/r-pkg-team/r-cran-devtools.git diff -Nru r-cran-devtools-2.4.4/DESCRIPTION r-cran-devtools-2.4.5/DESCRIPTION --- r-cran-devtools-2.4.4/DESCRIPTION 2022-07-20 18:30:02.000000000 +0000 +++ r-cran-devtools-2.4.5/DESCRIPTION 2022-10-11 17:12:36.000000000 +0000 @@ -1,6 +1,6 @@ Package: devtools Title: Tools to Make Developing R Packages Easier -Version: 2.4.4 +Version: 2.4.5 Authors@R: c( person("Hadley", "Wickham", role = "aut"), person("Jim", "Hester", role = "aut"), @@ -19,7 +19,7 @@ 0.1.1.1), pkgbuild (>= 1.3.1), pkgdown (>= 2.0.6), pkgload (>= 1.3.0), profvis (>= 0.3.7), rcmdcheck (>= 1.4.0), remotes (>= 2.4.2), rlang (>= 1.0.4), roxygen2 (>= 7.2.1), rversions (>= - 2.1.1), sessioninfo (>= 1.2.2), stats, testthat (>= 3.1.4), + 2.1.1), sessioninfo (>= 1.2.2), stats, testthat (>= 3.1.5), tools, urlchecker (>= 1.0.1), utils, withr (>= 2.5.0) Suggests: BiocManager (>= 1.30.18), callr (>= 3.7.1), covr (>= 3.5.1), curl (>= 4.3.2), digest (>= 0.6.29), DT (>= 0.23), foghorn (>= @@ -34,7 +34,7 @@ RoxygenNote: 7.2.1 Config/testthat/edition: 3 NeedsCompilation: no -Packaged: 2022-07-20 17:08:03 UTC; jenny +Packaged: 2022-10-11 16:13:16 UTC; jenny Author: Hadley Wickham [aut], Jim Hester [aut], Winston Chang [aut], @@ -42,4 +42,4 @@ RStudio [cph, fnd] Maintainer: Jennifer Bryan Repository: CRAN -Date/Publication: 2022-07-20 18:30:02 UTC +Date/Publication: 2022-10-11 17:12:36 UTC diff -Nru r-cran-devtools-2.4.4/inst/doc/dependencies.html r-cran-devtools-2.4.5/inst/doc/dependencies.html --- r-cran-devtools-2.4.4/inst/doc/dependencies.html 2022-07-20 17:08:02.000000000 +0000 +++ r-cran-devtools-2.4.5/inst/doc/dependencies.html 2022-10-11 16:13:15.000000000 +0000 @@ -12,7 +12,7 @@ - + Devtools dependencies @@ -122,13 +122,20 @@ for (var i = 0; i < sheets.length; i++) { if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue; try { var rules = sheets[i].cssRules; } catch (e) { continue; } - for (var j = 0; j < rules.length; j++) { + var j = 0; + while (j < rules.length) { var rule = rules[j]; // check if there is a div.sourceCode rule - if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue; + if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") { + j++; + continue; + } var style = rule.style.cssText; // check if color or background-color is set - if (rule.style.color === '' && rule.style.backgroundColor === '') continue; + if (rule.style.color === '' && rule.style.backgroundColor === '') { + j++; + continue; + } // replace div.sourceCode by a pre.sourceCode rule sheets[i].deleteRule(j); sheets[i].insertRule('pre.sourceCode{' + style + '}', j); @@ -334,7 +341,7 @@

Devtools dependencies

Jim Hester, Hadley Wickham

-

2022-07-20

+

2022-10-11

diff -Nru r-cran-devtools-2.4.4/man/check.Rd r-cran-devtools-2.4.5/man/check.Rd --- r-cran-devtools-2.4.4/man/check.Rd 2022-01-14 22:57:28.000000000 +0000 +++ r-cran-devtools-2.4.5/man/check.Rd 2022-08-11 23:07:05.000000000 +0000 @@ -3,7 +3,7 @@ \name{check} \alias{check} \alias{check_built} -\title{Build and check a package, cleaning up automatically on success.} +\title{Build and check a package} \usage{ check( pkg = ".", @@ -19,8 +19,8 @@ args = "--timings", env_vars = c(NOT_CRAN = "true"), quiet = FALSE, - check_dir = tempdir(), - cleanup = TRUE, + check_dir = NULL, + cleanup = deprecated(), vignettes = TRUE, error_on = c("never", "error", "warning", "note") ) @@ -52,27 +52,26 @@ \item{...}{Additional arguments passed on to \code{\link[pkgbuild:build]{pkgbuild::build()}}.} -\item{manual}{If \code{FALSE}, don't build and check manual -(\code{--no-manual}).} - -\item{cran}{if \code{TRUE} (the default), check using the same settings as -CRAN uses.} +\item{manual}{If \code{FALSE}, don't build and check manual (\code{--no-manual}).} -\item{remote}{Sets \verb{_R_CHECK_CRAN_INCOMING_REMOTE_} env var. -If \code{TRUE}, performs a number of CRAN incoming checks that require -remote access.} - -\item{incoming}{Sets \verb{_R_CHECK_CRAN_INCOMING_} env var. -If \code{TRUE}, performs a number of CRAN incoming checks.} - -\item{force_suggests}{Sets \verb{_R_CHECK_FORCE_SUGGESTS_}. If -\code{FALSE} (the default), check will proceed even if all suggested -packages aren't found.} - -\item{run_dont_test}{Sets \code{--run-donttest} so that tests surrounded in -\verb{\donttest{}} are also tested. When \code{cran = TRUE}, this only affects -R 3.6 and earlier; in R 4.0.0 code in \verb{\donttest{}} is always run as -part of CRAN submission.} +\item{cran}{if \code{TRUE} (the default), check using the same settings as CRAN +uses. Because this is a moving target and is not uniform across all of +CRAN's machine, this is on a "best effort" basis. It is more complicated +than simply setting \code{--as-cran}.} + +\item{remote}{Sets \verb{_R_CHECK_CRAN_INCOMING_REMOTE_} env var. If \code{TRUE}, +performs a number of CRAN incoming checks that require remote access.} + +\item{incoming}{Sets \verb{_R_CHECK_CRAN_INCOMING_} env var. If \code{TRUE}, performs a +number of CRAN incoming checks.} + +\item{force_suggests}{Sets \verb{_R_CHECK_FORCE_SUGGESTS_}. If \code{FALSE} (the +default), check will proceed even if all suggested packages aren't found.} + +\item{run_dont_test}{Sets \code{--run-donttest} so that examples surrounded in +\verb{\donttest{}} are also run. When \code{cran = TRUE}, this only affects R 3.6 and +earlier; in R 4.0, code in \verb{\donttest{}} is always run as part of CRAN +submission.} \item{args}{Character vector of arguments to pass to \verb{R CMD check}. Pass each argument as a single element of this character vector (do not use spaces to @@ -86,11 +85,11 @@ \item{quiet}{if \code{TRUE} suppresses output from this function.} -\item{check_dir}{the directory in which the package is checked -compatibility. \code{args = "--output=/foo/bar"} can be used to change the -check directory.} +\item{check_dir}{Path to a directory where the check is performed. +If this is not \code{NULL}, then the a temporary directory is used, that +is cleaned up when the returned object is garbage collected.} -\item{cleanup}{Deprecated.} +\item{cleanup}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} See \code{check_dir} for details.} \item{vignettes}{If \code{FALSE}, do not build or check vignettes, equivalent to using \verb{args = '--ignore-vignettes' and }build_args = '--no-build-vignettes'.} @@ -107,23 +106,23 @@ \item{path}{Path to built package.} } \value{ -An object containing errors, warnings, and notes. +An object containing errors, warnings, notes, and more. } \description{ -\code{check} automatically builds and checks a source package, using all -known best practices. \code{check_built} checks an already built package. -} -\details{ -Passing \verb{R CMD check} is essential if you want to submit your package -to CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure -that there are as few NOTEs as possible. If you are not submitting to CRAN, -at least ensure that there are no ERRORs or WARNINGs: these typically -represent serious problems. - -\code{check} automatically builds a package before calling \code{check_built} -as this is the recommended way to check packages. Note that this process -runs in an independent realisation of R, so nothing in your current -workspace will affect the process. +\code{check()} automatically builds and checks a source package, using all known +best practices. \code{check_built()} checks an already-built package. + +Passing \verb{R CMD check} is essential if you want to submit your package to +CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure that +there are as few NOTEs as possible. If you are not submitting to CRAN, at +least ensure that there are no ERRORs or WARNINGs: these typically represent +serious problems. + +\code{check()} automatically builds a package before calling \code{check_built()}, as +this is the recommended way to check packages. Note that this process runs +in an independent R session, so nothing in your current workspace will affect +the process. Under-the-hood, \code{check()} and \code{check_built()} rely on +\code{\link[pkgbuild:build]{pkgbuild::build()}} and \code{\link[rcmdcheck:rcmdcheck]{rcmdcheck::rcmdcheck()}}. } \section{Environment variables}{ diff -Nru r-cran-devtools-2.4.4/MD5 r-cran-devtools-2.4.5/MD5 --- r-cran-devtools-2.4.4/MD5 2022-07-20 18:30:02.000000000 +0000 +++ r-cran-devtools-2.4.5/MD5 2022-10-11 17:12:36.000000000 +0000 @@ -1,7 +1,7 @@ -13f1d401a8fc484014dc78bd221c3099 *DESCRIPTION +0367a14708b495c4f717368897de0d74 *DESCRIPTION 19545c77acbd277a383c948b34f77d84 *LICENSE 96c4691721a2b8131331f0349004669b *NAMESPACE -e8037b8667d901ddff3b2669eb8fcb66 *NEWS.md +4aa33b527aaa0b8b4d833c7301f0c01f *NEWS.md f72c92122cbbe5562dd8614be2dd36f7 *R/R.R cb270bc1be983c3298f52217a787127a *R/active.R ce3be42a5b85d95cbee8d7fd7fb4a62d *R/bash.R @@ -13,7 +13,7 @@ 0fce8f9aff8a8e0534000ff21a21c8cc *R/check-git.R 691db727bf24691da36c93341bb93abf *R/check-mac.R d2d9050b32f5a0e2be5f746bf3ac3472 *R/check-win.R -1a9d69a359bd6e3f6945af3b8d5858c3 *R/check.R +f53207e7b4965b63ab2662c042192058 *R/check.R a209c238f5e01cbbfb3ee08ff301b0a1 *R/create.R a4133446b36c10e1f5d39b7699103781 *R/dev-mode.R 07f7d2e1507d116dc62223dfce7eefce *R/devtools-package.R @@ -39,19 +39,19 @@ 4f9971a681f35dc578a2bc02b986d4be *R/show-news.R 94af98455e278036256b18e0925b89cf *R/sitrep.R dbc6bc73afa1dcd41e156e2709d2ee22 *R/spell-check.R -ba8b272df3acad74140caf9360bc7603 *R/test.R +dd25369f0534db7a1f3424b2a2f3586d *R/test.R 44f6c176ceae3e0e46b6a54ef00b9a56 *R/uninstall.R 620c8472e2765e78404724111122b670 *R/usethis.R -fec86d67388b61be8ed57a4aaeb4d174 *R/utils.R +c6888e56df0b2829994637b706d73e83 *R/utils.R f643a5a8eb8f64b3d4604996ed0cc9c3 *R/vignette-r.R a5b03f6ad1d9c96ebba6a270c9e011be *R/vignettes.R 2a9c4a7d84a8bafcfbeaaad4476d13ab *R/wd.R f32bf7a0965ad6b636896f5171c6c31c *R/zzz.R 9b8b72c5813b3afcb39ba679dd2eb2e4 *README.md -e5d208e8455fe8a0e464b12eb8120697 *build/vignette.rds +269feeafcf559598485bf407dd5eb0d8 *build/vignette.rds 756b2e5b43af8d23ad6b641c898f3c68 *inst/WORDLIST e537d648a6ceb5fd6cc5e5f5450e7ad5 *inst/doc/dependencies.Rmd -848e7ead60834edd56c7297fa5cc44ce *inst/doc/dependencies.html +55c7802db29da8f47bd41b7c1a850b95 *inst/doc/dependencies.html 48df05798555d5765a367c469daf7375 *inst/rstudio/addins.dcf 8672ff1ecc8b67af619161ddc9b76c5b *man/as.package.Rd 4b1d5143f8dcd64533fefd1c9a371620 *man/bash.Rd @@ -60,7 +60,7 @@ 4893b5c00f80602199a220cf05aa270b *man/build_rmd.Rd 0b4f1dfb339eeeb86148a3952159e87b *man/build_site.Rd e52804eaa4ba7247f05ed35067db2df6 *man/build_vignettes.Rd -16451d2a49021e627181552fd7f78a97 *man/check.Rd +b9986e41ed573f7c30abaf570b7a9d0d *man/check.Rd c731d089e443c180749acb234d5c0fb7 *man/check_mac_release.Rd 5912c6f34faf6bfb3b3480633732a961 *man/check_man.Rd 9a9a5ecd9d8a37ee4a6ef5f6c255c5f4 *man/check_rhub.Rd @@ -142,7 +142,7 @@ 2c5c8c2ecd3ff94e2d4b21798a5a57f6 *tests/testthat/test-run-examples.R 8aac3b208f5fb81c8eea834f0df3cea3 *tests/testthat/test-run-source.R 5cafcd35b1c6a266acb255d266f91244 *tests/testthat/test-sitrep.R -1af4c5e8ae88c4604c7b44489c6ad3ff *tests/testthat/test-test.R +8810fd4ecb143a889d4fd5bad4259cfe *tests/testthat/test-test.R e97fc73f9d8f1d095a5c966935911b5d *tests/testthat/test-uninstall.R d38c15bdf1db1f8f7f032eef857986b0 *tests/testthat/test-utils.R b5785bd34e818fb328fb8b48c4c6195b *tests/testthat/test-vignettes.R diff -Nru r-cran-devtools-2.4.4/NEWS.md r-cran-devtools-2.4.5/NEWS.md --- r-cran-devtools-2.4.4/NEWS.md 2022-07-20 17:06:30.000000000 +0000 +++ r-cran-devtools-2.4.5/NEWS.md 2022-10-11 16:12:02.000000000 +0000 @@ -1,3 +1,23 @@ +# devtools 2.4.5 + +* `check(cleanup =)` was deprecated in devtools v1.11.0 (2016-04-12) and was + made defunct in v2.4.4 (2022-07-20). The documentation is more clear now about + recommended alternatives. + +* `check(check_dir = NULL)` is the new default, to align with the default + behaviour of the underlying `rcmdcheck::rcmdcheck()`. + +* `check(cran = TRUE)` sets the env var + `_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_` to `FALSE`, in order to + surface the `"Namespace in Imports field not imported from"` NOTE. This only + applies to R >= 4.2, due to favorable changes in the behaviour of + `R CMD check --as-cran` (#2459). + +* `test_active_file()` passes the package onto to testthat so it can correctly + set the `TESTTHAT_PKG` envvar (#2470). + +* `test()` and `test_active_file()` once again work with testthat itself. + # devtools 2.4.4 * `install(reload = TRUE)` now calls `pkgload::unregister()` instead diff -Nru r-cran-devtools-2.4.4/R/check.R r-cran-devtools-2.4.5/R/check.R --- r-cran-devtools-2.4.4/R/check.R 2022-07-19 13:39:32.000000000 +0000 +++ r-cran-devtools-2.4.5/R/check.R 2022-08-11 23:07:05.000000000 +0000 @@ -1,18 +1,20 @@ -#' Build and check a package, cleaning up automatically on success. +#' Build and check a package #' -#' `check` automatically builds and checks a source package, using all -#' known best practices. `check_built` checks an already built package. -#' -#' Passing `R CMD check` is essential if you want to submit your package -#' to CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure -#' that there are as few NOTEs as possible. If you are not submitting to CRAN, -#' at least ensure that there are no ERRORs or WARNINGs: these typically -#' represent serious problems. -#' -#' `check` automatically builds a package before calling `check_built` -#' as this is the recommended way to check packages. Note that this process -#' runs in an independent realisation of R, so nothing in your current -#' workspace will affect the process. +#' @description +#' `check()` automatically builds and checks a source package, using all known +#' best practices. `check_built()` checks an already-built package. +#' +#' Passing `R CMD check` is essential if you want to submit your package to +#' CRAN: you must not have any ERRORs or WARNINGs, and you want to ensure that +#' there are as few NOTEs as possible. If you are not submitting to CRAN, at +#' least ensure that there are no ERRORs or WARNINGs: these typically represent +#' serious problems. +#' +#' `check()` automatically builds a package before calling `check_built()`, as +#' this is the recommended way to check packages. Note that this process runs +#' in an independent R session, so nothing in your current workspace will affect +#' the process. Under-the-hood, `check()` and `check_built()` rely on +#' [pkgbuild::build()] and [rcmdcheck::rcmdcheck()]. #' #' @section Environment variables: #' @@ -37,19 +39,17 @@ #' `force_suggests` #' } #' -#' @return An object containing errors, warnings, and notes. +#' @return An object containing errors, warnings, notes, and more. #' @template devtools +#' @inheritParams rcmdcheck::rcmdcheck #' @param document By default (`NULL`) will document if your installed #' roxygen2 version matches the version declared in the `DESCRIPTION` #' file. Use `TRUE` or `FALSE` to override the default. #' @param build_args Additional arguments passed to `R CMD build` -#' @param check_dir the directory in which the package is checked -#' compatibility. `args = "--output=/foo/bar"` can be used to change the -#' check directory. #' @param ... Additional arguments passed on to [pkgbuild::build()]. #' @param vignettes If `FALSE`, do not build or check vignettes, equivalent to #' using `args = '--ignore-vignettes' and `build_args = '--no-build-vignettes'. -#' @param cleanup Deprecated. +#' @param cleanup `r lifecycle::badge("deprecated")` See `check_dir` for details. #' @seealso [release()] if you want to send the checked package to #' CRAN. #' @export @@ -66,8 +66,8 @@ args = "--timings", env_vars = c(NOT_CRAN = "true"), quiet = FALSE, - check_dir = tempdir(), - cleanup = TRUE, + check_dir = NULL, + cleanup = deprecated(), vignettes = TRUE, error_on = c("never", "error", "warning", "note")) { pkg <- as.package(pkg) @@ -75,8 +75,8 @@ save_all() - if (!missing(cleanup)) { - lifecycle::deprecate_stop("1.11.0", "lifecycle::check(cleanup = )") + if (lifecycle::is_present(cleanup)) { + lifecycle::deprecate_stop("1.11.0", "check(cleanup = )") } if (missing(error_on) && !interactive()) { @@ -158,22 +158,21 @@ #' @export #' @rdname check #' @param path Path to built package. -#' @param cran if `TRUE` (the default), check using the same settings as -#' CRAN uses. -#' @param remote Sets `_R_CHECK_CRAN_INCOMING_REMOTE_` env var. -#' If `TRUE`, performs a number of CRAN incoming checks that require -#' remote access. -#' @param incoming Sets `_R_CHECK_CRAN_INCOMING_` env var. -#' If `TRUE`, performs a number of CRAN incoming checks. -#' @param force_suggests Sets `_R_CHECK_FORCE_SUGGESTS_`. If -#' `FALSE` (the default), check will proceed even if all suggested -#' packages aren't found. -#' @param run_dont_test Sets `--run-donttest` so that tests surrounded in -#' `\donttest{}` are also tested. When `cran = TRUE`, this only affects -#' R 3.6 and earlier; in R 4.0.0 code in `\donttest{}` is always run as -#' part of CRAN submission. -#' @param manual If `FALSE`, don't build and check manual -#' (`--no-manual`). +#' @param cran if `TRUE` (the default), check using the same settings as CRAN +#' uses. Because this is a moving target and is not uniform across all of +#' CRAN's machine, this is on a "best effort" basis. It is more complicated +#' than simply setting `--as-cran`. +#' @param remote Sets `_R_CHECK_CRAN_INCOMING_REMOTE_` env var. If `TRUE`, +#' performs a number of CRAN incoming checks that require remote access. +#' @param incoming Sets `_R_CHECK_CRAN_INCOMING_` env var. If `TRUE`, performs a +#' number of CRAN incoming checks. +#' @param force_suggests Sets `_R_CHECK_FORCE_SUGGESTS_`. If `FALSE` (the +#' default), check will proceed even if all suggested packages aren't found. +#' @param run_dont_test Sets `--run-donttest` so that examples surrounded in +#' `\donttest{}` are also run. When `cran = TRUE`, this only affects R 3.6 and +#' earlier; in R 4.0, code in `\donttest{}` is always run as part of CRAN +#' submission. +#' @param manual If `FALSE`, don't build and check manual (`--no-manual`). #' @param env_vars Environment variables set during `R CMD check` #' @param quiet if `TRUE` suppresses output from this function. #' @inheritParams rcmdcheck::rcmdcheck @@ -191,6 +190,10 @@ if (cran) { args <- c("--as-cran", args) + env_vars <- c( + "_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_" = as.character(FALSE), + env_vars + ) } if (run_dont_test) { args <- c("--run-donttest", args) diff -Nru r-cran-devtools-2.4.4/R/test.R r-cran-devtools-2.4.5/R/test.R --- r-cran-devtools-2.4.4/R/test.R 2022-07-19 13:39:32.000000000 +0000 +++ r-cran-devtools-2.4.5/R/test.R 2022-10-11 16:06:48.000000000 +0000 @@ -37,10 +37,13 @@ cli::cli_inform(c(i = "Testing {.pkg {pkg$package}}")) withr::local_envvar(r_env_vars()) + + load_package <- load_package_if_needed(pkg) testthat::test_local( pkg$path, filter = filter, stop_on_failure = stop_on_failure, + load_package = load_package, ... ) } @@ -60,7 +63,28 @@ pkg <- as.package(path_dir(test_files)[[1]]) withr::local_envvar(r_env_vars()) - testthat::test_file(test_files, ..., load_package = "source") + if (is_rstudio_running()) { + rstudioapi::executeCommand("activateConsole", quiet = TRUE) + } + + load_package <- load_package_if_needed(pkg) + testthat::test_file( + test_files, + package = pkg$package, + load_package = load_package, + ... + ) +} + +load_package_if_needed <- function(pkg) { + if (pkg$package == "testthat") { + # Must load testthat outside of testthat so tests are run with + # dev testthat + load_all(pkg$path, quiet = TRUE) + "none" + } else { + "source" + } } #' @param show_report Show the test coverage report. diff -Nru r-cran-devtools-2.4.4/R/utils.R r-cran-devtools-2.4.5/R/utils.R --- r-cran-devtools-2.4.4/R/utils.R 2022-05-25 17:34:18.000000000 +0000 +++ r-cran-devtools-2.4.5/R/utils.R 2022-09-01 15:08:49.000000000 +0000 @@ -9,15 +9,6 @@ get(f, envir = asNamespace(p)) } -# Modified version of utils::file_ext. Instead of always returning the text -# after the last '.', as in "foo.tar.gz" => ".gz", if the text that directly -# precedes the last '.' is ".tar", it will include also, so -# "foo.tar.gz" => ".tar.gz" -file_ext <- function(x) { - pos <- regexpr("\\.((tar\\.)?[[:alnum:]]+)$", x) - ifelse(pos > -1L, substring(x, pos + 1L), "") -} - is_windows <- isTRUE(.Platform$OS.type == "windows") sort_ci <- function(x) { @@ -35,28 +26,6 @@ !is.null(pkgload::pkg_env(pkg$package)) } -# This is base::trimws from 3.2 on -trim_ws <- function(x, which = c("both", "left", "right")) { - which <- match.arg(which) - mysub <- function(re, x) sub(re, "", x, perl = TRUE) - if (which == "left") { - return(mysub("^[ \t\r\n]+", x)) - } - if (which == "right") { - return(mysub("[ \t\r\n]+$", x)) - } - mysub("[ \t\r\n]+$", mysub("^[ \t\r\n]+", x)) -} - -menu <- function(...) { - utils::menu(...) -} - -escape_special_regex <- function(x) { - chars <- c("*", ".", "?", "^", "+", "$", "|", "(", ")", "[", "]", "{", "}", "\\") - gsub(paste0("([\\", paste0(collapse = "\\", chars), "])"), "\\\\\\1", x, perl = TRUE) -} - vcapply <- function(x, FUN, ...) { vapply(x, FUN, FUN.VALUE = character(1), ...) } diff -Nru r-cran-devtools-2.4.4/tests/testthat/test-test.R r-cran-devtools-2.4.5/tests/testthat/test-test.R --- r-cran-devtools-2.4.4/tests/testthat/test-test.R 2021-12-03 23:19:33.000000000 +0000 +++ r-cran-devtools-2.4.5/tests/testthat/test-test.R 2022-10-11 16:06:48.000000000 +0000 @@ -31,8 +31,19 @@ expect_equal(length(out), 1) }) -test_that("TESTTHAT_PKG environment varaible is set", { - test_test(test_path("testTest"), filter = "envvar") +test_that("TESTTHAT_PKG environment variable is set", { + withr::local_envvar("TESTTHAT_PKG" = "incorrect") + + test_test( + test_path("testTest"), + filter = "envvar", + stop_on_failure = TRUE + ) + test_active_file( + test_path("testTest/tests/testthat/test-envvar.R"), + stop_on_failure = TRUE + ) + expect_true(TRUE) })