We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from @s-u
1. Error: can mock if package is not loaded ------------------------------------ there is no package called 'devtools' 1: withCallingHandlers(eval(code, new_test_environment), error = capture_calls) 2: eval(code, new_test_environment) 3: eval(expr, envir, enclos) 4: with_mock(`devtools::add_path` = identity, expect_identical(devtools::add_path, identity)) at test-mock.r:120 5: extract_mocks(new_values = new_values[!code_pos], .env = .env) 6: lapply(setNames(nm = mock_qual_names), function(qual_name) { pkg_name <- gsub(pkg_and_name_rx, "\\1", qual_name) name <- gsub(pkg_and_name_rx, "\\2", qual_name) if (pkg_name == "") pkg_name <- .env env <- asNamespace(pkg_name) if (!exists(name, envir = env, mode = "function")) stop("Function ", name, " not found in environment ", environmentName(env), ".") mock(name = name, env = env, new = eval(new_values[[qual_name]])) }) 7: FUN(X[[i]], ...) 8: asNamespace(pkg_name) 9: getNamespace(ns) 10: tryCatch(loadNamespace(name), error = function(e) stop(e)) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 13: value[[3L]](cond) Error: Test failures Execution halted
@krlmlr can you please take a look?
The text was updated successfully, but these errors were encountered:
I know I am not Kirill, but it looks like adding the following before tests/testthat/test-mock.r#L119-L121 should fix this
if (!"devtools" %in% installed.packages()[, "Package"]) skip("devtools is not installed")
Sorry, something went wrong.
FWIW installed.packages() is not cheap so it may be faster to use
installed.packages()
if (!length(find.package("devtools", quiet=TRUE)))
Thanks, @jimhester and @s-u.
Successfully merging a pull request may close this issue.
from @s-u
@krlmlr can you please take a look?
The text was updated successfully, but these errors were encountered: