Recently, I get following errors from doing check()
. When doing test()
everything passes. What could be a reason?
Error ('test-createFolders.R:15:3'): createFolders: create directory ──
Error in `get(genname, envir = envir)`: object 'compare_proxy' not found
Backtrace:
▆
1. ├─testthat::expect_identical(sort(my_dirs), c("archive", "overall", "projects")) at test-createFolders.R:15:3
2. │ └─testthat:::expect_waldo_equal("identical", act, exp, info, ...)
3. │ └─testthat:::waldo_compare(...)
4. └─base::loadNamespace(x)
5. ├─base::namespaceImportFrom(...)
6. │ └─base::asNamespace(ns)
7. └─base::loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
8. └─base::registerS3methods(nsInfo$S3methods, package, env)
9. └─base (local) register_S3_method_delayed(pkg, gen, cls, fun)
10. └─base::registerS3method(gen, cls, fun, envir = asNamespace(pkg))
11. └─base::get(genname, envir = envir)
test:
test_that("createFolders: create directory", {
temp_dir <- tempfile()
if(dir.exists(temp_dir))
unlink(temp_dir, recursive = TRUE)
createFolders(temp_dir)
my_dirs <- basename(list.dirs(temp_dir, recursive = FALSE))
expect_identical(sort(my_dirs), c("archive", "overall", "projects"))
})
Where:
createFolders <- function(folder){
FOLDERS <- c("projects", "overall", "archive")
if(!dir.exists(folder))
stop("folder exists")
# create folder
dir.create(campaign_folder)
# create subfolders
purrr::walk(file.path(folder, FOLDERS), dir.create)
}
Also I have some other tests that create xlsx document using openxlsx::write.xlsx
. It seems that they fail also when using check()
. Like I said, this did not happen before, it started after I've updated some R packages after installing package.