我的包中的这个测试与devtools::test(). 在线 Travis 构建也进展顺利。
test_that("Package style", {
lintr::expect_lint_free()
})
Run Code Online (Sandbox Code Playgroud)
然而,devtools::check()它失败了。错误信息是
invalid 'path' argument
Backtrace:
1. lintr::expect_lint_free()
2. lintr::lint_package(...)
3. base::normalizePath(path, mustWork = FALSE)
4. base::path.expand(path)
Run Code Online (Sandbox Code Playgroud)
我在 Windows 上运行 R 版本 3.6.3 (2020-02-29)、testthat 2.3.2 和 lintr 2.0.1。
我认为问题是 lintr 不知道要 lintr 哪个文件。
有人可以向我指出这个问题的解决方案是什么吗?
这是lintr 的已知错误。目前,最好的解决方法是将代码替换为:
if (requireNamespace("lintr", quietly = TRUE)) {
library(lintr)
context("linting package")
test_that("Package Style", {
# A duplicate copy of the find_package function from lintr
find_package <- function(path) {
path <- normalizePath(path, mustWork = FALSE)
while (!file.exists(file.path(path, "DESCRIPTION"))) {
path <- dirname(path)
if (identical(path, dirname(path))) {
return(NULL)
}
}
path
}
if (!is.null(find_package("."))) {
expect_lint_free()
)
}
})
}
Run Code Online (Sandbox Code Playgroud)
该解决方案的来源位于同一个链接中。
| 归档时间: |
|
| 查看次数: |
213 次 |
| 最近记录: |