admin管理员组文章数量:1400028
Im new to creating R packages and trying to build my first package that contains a few functions that test if certain expectations about values in variables are met in dataframes. Right now i am stuck with an error that i get from devtools::check() after i implemented some tests with testthat package:
── Error ('test-ac_tags.R:1:1'): (code run outside of `test_that()`) ───────────
Error in `get(genname, envir = envir)`: object 'compare_proxy' not found
Backtrace:
▆
1. ├─testthat::test_check("nepstest")
2. │ └─testthat::test_dir(...)
3. │ └─testthat:::test_files(...)
4. │ └─testthat:::test_files_serial(...)
5. │ ├─testthat::with_reporter(...)
6. │ │ └─base::tryCatch(...)
7. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
8. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
9. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
10. │ └─base::lapply(...)
11. │ └─testthat (local) FUN(X[[i]], ...)
12. │ └─testthat::source_file(path, env = env(env), desc = desc, error_call = error_call)
13. │ └─testthat:::test_code(test = NULL, code = exprs, env = env, default_reporter = StopReporter$new())
14. │ ├─base::tryCatch(...)
15. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
16. │ │ ├─base (local) tryCatchOne(...)
17. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
18. │ │ └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
19. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
20. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
21. │ ├─base::withCallingHandlers(...)
22. │ └─base::eval(code, test_env)
23. │ └─base::eval(code, test_env)
24. │ └─testthat::test_that(...) at test-ac_tags.R:1:1
25. │ └─testthat:::test_code(desc, code, env = parent.frame(), default_reporter = local_interactive_reporter())
26. │ └─testthat:::testthat_state_condition(before, after, call = sys.call(-1))
27. │ └─testthat:::waldo_compare(before, after, x_arg = "before", y_arg = "after")
28. └─base::loadNamespace(x)
29. ├─base::namespaceImportFrom(...)
30. │ └─base::asNamespace(ns)
31. └─base::loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
32. └─base::registerS3methods(nsInfo$S3methods, package, env)
33. └─base (local) register_S3_method_delayed(pkg, gen, cls, fun)
34. └─base::registerS3method(gen, cls, fun, envir = asNamespace(pkg))
35. └─base::get(genname, envir = envir)
── Error ('test-misc_functions.R:1:1'): (code run outside of `test_that()`) ────
Error in `get(genname, envir = envir)`: object 'compare_proxy' not found
Backtrace:
▆
1. ├─testthat::test_check("nepstest")
2. │ └─testthat::test_dir(...)
3. │ └─testthat:::test_files(...)
4. │ └─testthat:::test_files_serial(...)
5. │ ├─testthat::with_reporter(...)
6. │ │ └─base::tryCatch(...)
7. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
8. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
9. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
10. │ └─base::lapply(...)
11. │ └─testthat (local) FUN(X[[i]], ...)
12. │ └─testthat::source_file(path, env = env(env), desc = desc, error_call = error_call)
13. │ └─testthat:::test_code(test = NULL, code = exprs, env = env, default_reporter = StopReporter$new())
14. │ ├─base::tryCatch(...)
15. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
16. │ │ ├─base (local) tryCatchOne(...)
17. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
18. │ │ └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
19. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
20. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
21. │ ├─base::withCallingHandlers(...)
22. │ └─base::eval(code, test_env)
23. │ └─base::eval(code, test_env)
24. │ └─testthat::test_that(...) at test-misc_functions.R:1:1
25. │ └─testthat:::test_code(desc, code, env = parent.frame(), default_reporter = local_interactive_reporter())
26. │ └─testthat:::testthat_state_condition(before, after, call = sys.call(-1))
27. │ └─testthat:::waldo_compare(before, after, x_arg = "before", y_arg = "after")
28. └─base::loadNamespace(x)
29. ├─base::namespaceImportFrom(...)
30. │ └─base::asNamespace(ns)
31. └─base::loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
32. └─base::registerS3methods(nsInfo$S3methods, package, env)
33. └─base (local) register_S3_method_delayed(pkg, gen, cls, fun)
34. └─base::registerS3method(gen, cls, fun, envir = asNamespace(pkg))
35. └─base::get(genname, envir = envir)
── Error ('test-na_checks.R:1:1'): (code run outside of `test_that()`) ─────────
Error in `get(genname, envir = envir)`: object 'compare_proxy' not found
Backtrace:
▆
1. ├─testthat::test_check("nepstest")
2. │ └─testthat::test_dir(...)
3. │ └─testthat:::test_files(...)
4. │ └─testthat:::test_files_serial(...)
5. │ ├─testthat::with_reporter(...)
6. │ │ └─base::tryCatch(...)
7. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
8. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
9. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
10. │ └─base::lapply(...)
11. │ └─testthat (local) FUN(X[[i]], ...)
12. │ └─testthat::source_file(path, env = env(env), desc = desc, error_call = error_call)
13. │ └─testthat:::test_code(test = NULL, code = exprs, env = env, default_reporter = StopReporter$new())
14. │ ├─base::tryCatch(...)
15. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
16. │ │ ├─base (local) tryCatchOne(...)
17. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
18. │ │ └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
19. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
20. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
21. │ ├─base::withCallingHandlers(...)
22. │ └─base::eval(code, test_env)
23. │ └─base::eval(code, test_env)
24. │ └─testthat::test_that(...) at test-na_checks.R:1:1
25. │ └─testthat:::test_code(desc, code, env = parent.frame(), default_reporter = local_interactive_reporter())
26. │ └─testthat:::testthat_state_condition(before, after, call = sys.call(-1))
27. │ └─testthat:::waldo_compare(before, after, x_arg = "before", y_arg = "after")
28. └─base::loadNamespace(x)
29. ├─base::namespaceImportFrom(...)
30. │ └─base::asNamespace(ns)
31. └─base::loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]])
32. └─base::registerS3methods(nsInfo$S3methods, package, env)
33. └─base (local) register_S3_method_delayed(pkg, gen, cls, fun)
34. └─base::registerS3method(gen, cls, fun, envir = asNamespace(pkg))
35. └─base::get(genname, envir = envir)
My tests with devtools::test() all just run fine but with check() there seems to be some kind of environment problem. Before i included testthat in the package developement, devtools::check() ran without errors.
From other posts ive learned that these sorts of problems can arise from dependency issues but since i only used base R and utils and declared utils in the DESCRIPTION file as an import this shouldnt be the case here.
Does anyone have an idea what the cause of this error message might be: "Error in get(genname, envir = envir)
: object 'compare_proxy' not found"
Thanks
本文标签: rerror message from using devtoolscheck() object 39compareproxy39 not foundStack Overflow
版权声明:本文标题:r - error message from using devtools::check(): object 'compare_proxy' not found - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744189171a2594435.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论