Skip to content

Commit 1e6d828

Browse files
Merge pull request #555 from lorenzwalthert/dev
Relax dependencies on stdout / stderr for third-party packages on CRAN
2 parents 9dda1f9 + c780c51 commit 1e6d828

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

R/release.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ release_msg <- function(last_release, new_version) {
9898
#' @param tag The tag to push. `NULL` will derive the tag from `DESCRIPTION`.
9999
#' @keywords internal
100100
release_complete <- function(ask = TRUE, is_cran = ask, tag = NULL) {
101+
abort_if_not_yes("Are you on main branch with no changes in worktree?")
101102
if (git_branch_get() != "main") {
102103
rlang::abort("Must be on main to complete the release.")
103104
}

R/testing.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,17 @@ not_conda <- function() {
273273
Sys.getenv("PRECOMMIT_INSTALLATION_METHOD") != "conda"
274274
}
275275

276+
#' Reduce a check to the empty string on CRAN
277+
#'
278+
#' In testing, we don't want to rely on exact error messages or stdout on CRAN
279+
#' for third-party packages, since this would complicate the release process for
280+
#' dependencies of \{precommit\}.
281+
#' @param string The string to test.
282+
#' @keywords internal
283+
empty_on_cran <- function(string) {
284+
ifelse(on_cran(), "", string)
285+
}
286+
276287
#' Testing utilities
277288
#'
278289
#' Similar to the `local_()` family from `{withr}`, this function creates a

man/empty_on_cran.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-hook-pkgdown.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ run_test("pkgdown",
1616
"DESCRIPTION" = "DESCRIPTION"
1717
),
1818
suffix = "",
19-
std_err = "topic must be a known"
19+
std_err = empty_on_cran("topic must be a known")
2020
)
2121

2222
# failed articles

tests/testthat/test-hook-roxygenize.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ run_test("roxygenize",
33
file_name = c("man/flie.Rd" = "flie.Rd"),
44
suffix = "",
55
std_err = NA,
6-
std_out = "Writing NAMESPACE",
6+
std_out = empty_on_cran("Writing NAMESPACE"),
77
artifacts = c(
88
"DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"),
99
"R/roxygenize.R" = test_path("in/roxygenize.R")
@@ -24,7 +24,7 @@ if (!on_cran()) {
2424
suffix = "",
2525
std_err = NA,
2626
cmd_args = "--root=rpkg",
27-
std_out = "Writing NAMESPACE",
27+
std_out = empty_on_cran("Writing NAMESPACE"),
2828
artifacts = c(
2929
"rpkg/DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"),
3030
"rpkg/R/roxygenize.R" = test_path("in/roxygenize.R")
@@ -79,7 +79,7 @@ run_test("roxygenize",
7979
run_test("roxygenize",
8080
file_name = c("man/flie.Rd" = "flie-true.Rd"),
8181
suffix = "",
82-
std_err = "Writing NAMESPACE",
82+
std_err = empty_on_cran("Writing NAMESPACE"),
8383
artifacts = c(
8484
"DESCRIPTION" = test_path("in/DESCRIPTION-no-deps.dcf"),
8585
"R/roxygenize.R" = test_path("in/roxygenize.R")

0 commit comments

Comments
 (0)