Skip to content

Commit 9f4e420

Browse files
remove dependency on mockery
1 parent 15a1ff4 commit 9f4e420

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

.github/workflows/hook-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
options(install.packages.compile.from.source = "never", pkgType = "binary")
6262
renv::restore()
6363
# install hook-specific additional_dependencies from .pre-commit-config.yaml
64-
renv::install(c('pkgdown', 'mockery'))
64+
renv::install(c('pkgdown'))
6565
renv::install(getwd(), dependencies = FALSE)
6666
# needed to make sure renv is activated in run_test()
6767
activate <- c(

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Suggests:
2929
glue,
3030
knitr,
3131
lintr,
32-
mockery,
3332
pkgload,
3433
pkgdown,
3534
reticulate (>= 1.16),

inst/update-dependency-graph-existing-packages.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ hook_deps <- function(root) {
44
deps <- desc$get_deps()
55
dont <- c(
66
"yaml", "usethis", "withr", "rstudioapi", "precommit",
7-
"pkgdown", "mockery",
7+
"pkgdown",
88
"httr"
99
)
10-
out <- c(out, "docopt", "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "desc", "mockery")
10+
out <- c(out, "docopt", "roxygen2", "spelling", "styler", "pkgload", "lintr", "knitr", "desc")
1111
out <- setdiff(c(unique(c(out, deps[deps$type == "Imports", ]$package))), dont)
1212
out <- names(renv:::renv_package_dependencies(out))
1313
return(sort(out))

tests/testthat/test-impl-hook-roxygenize.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ test_that("roxygenize works in general", {
8383
local_test_setup(git = FALSE, use_precommit = FALSE, package = TRUE)
8484
writeLines(c("#' This is a title", "#'", "#' More", "#' @name test", "NULL"), "R/blur.R")
8585
# works
86-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
86+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
8787
expect_message(
8888
roxygenize_with_cache(list(getwd()), dirs = dirs_R.cache("roxygenize")),
8989
"test\\.Rd"
@@ -96,7 +96,7 @@ test_that("fails when package is called but not installed in roclets", {
9696
local_test_setup(git = FALSE, use_precommit = FALSE, package = TRUE)
9797
writeLines(c("NULL"), "R/blur.R")
9898
# works
99-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
99+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
100100
# when there is a missing package
101101
roxygen_field <- paste0(
102102
'list(markdown = TRUE, roclets = c("rd", "namespace", "collate", "',
@@ -115,7 +115,7 @@ test_that("fails gratefully when not installed package is called (packageNotFoun
115115
local_test_setup(git = FALSE, use_precommit = FALSE, package = TRUE)
116116
writeLines(generate_uninstalled_pkg_call(), "R/blur.R")
117117
# works
118-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
118+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
119119
# when there is a missing package
120120
expect_error(
121121
roxygenize_with_cache(list(getwd()), dirs = dirs_R.cache("roxygenize")),
@@ -129,7 +129,7 @@ test_that("fails gratefully when not installed package is required according to
129129
desc::desc_set_deps(
130130
tibble::tibble(type = "Imports", package = generate_uninstalled_pkg_name(), version = "*")
131131
)
132-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
132+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
133133
expect_error(
134134
suppressWarnings(
135135
roxygenize_with_cache(list(getwd()), dirs = dirs_R.cache("roxygenize"))
@@ -142,7 +142,7 @@ test_that("fails gratefully when not installed package is required according to
142142
test_that("fails when there is invalid code", {
143143
skip_on_cran()
144144
local_test_setup(git = FALSE, use_precommit = FALSE, package = TRUE)
145-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
145+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
146146
# when there is a missing package
147147
writeLines(c("invalid code stuff /3kj"), "R/more.R")
148148
expect_error(
@@ -154,7 +154,7 @@ test_that("fails when there is invalid code", {
154154
test_that("warns if there is any other warning", {
155155
skip_on_cran()
156156
local_test_setup(git = FALSE, use_precommit = FALSE, package = TRUE)
157-
mockery::stub(roxygenize_with_cache, "diff_requires_run_roxygenize", TRUE)
157+
local_mocked_bindings(diff_requires_run_roxygenize = function(...) TRUE)
158158
writeLines(
159159
c(
160160
"#' This is a title", "#'", "#' More", "#", "NULL"

vignettes/available-hooks.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,6 @@ dependencies and system libraries.
355355

356356
For this check, we rely on the the global R package library and require all
357357
development dependencies of the package you want to run this hook for to be
358-
installed, as well as {pkgdown} (without its dependencies) and {mockery}.
358+
installed, as well as {pkgdown} (without its dependencies).
359359

360360
This hook does not modify files. Added in version 0.3.2.9003.

0 commit comments

Comments
 (0)