Last active
September 22, 2022 17:49
-
-
Save statnmap/5e822ce306fc28bbec92ae052370ec9b to your computer and use it in GitHub Desktop.
Check: for unstated dependencies in ‘tests’
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When in your package in development | |
db <- tools:::.read_description("DESCRIPTION") | |
testdir <- "tests/testthat" | |
Rinfiles <- list.files(testdir, pattern = "\\.Rin$", full.names = TRUE) | |
Rfiles <- list.files(testdir, pattern = "\\.[rR]$", full.names = TRUE) | |
res <- tools:::.check_packages_used_helper(db, c(Rinfiles, Rfiles)) | |
res | |
repos <- tools:::.get_standard_repository_URLs() | |
# This is not protected when no Internet connection is available | |
available <- utils::available.packages(repos = repos) | |
# This comes from | |
debugonce(tools:::.check_packages_used_in_tests) | |
tools:::.check_packages_used_in_tests(dir = ".", testdir = "tests/testthat") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you face:
This is because the check verify that all dependencies called in your package are registered in DESCRIPTION.
If not, the check search if this package exist in any of the existing repositories to recommend to add it.
But when your package creates fake packages to test that it correctly works, then you may have problems with CRAN.
Indeed, if you're asked to do something to account for users who do not have an Internet connection, then, you can now say that this problem arise because maintainers of {tools} package did not accounted for users without Internet connection. These maintainers are the CRAN Team...