由于使用testthat进行测试,CRAN上的包失败
我向CRAN提交了我的包,但它没有通过CRAN R CMD检查。 这是他们得到的错误:由于使用testthat进行测试,CRAN上的包失败,r,cran,testthat,R,Cran,Testthat,我向CRAN提交了我的包,但它没有通过CRAN R CMD检查。 这是他们得到的错误: * checking tests ... ERROR Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publicat
* checking tests ... ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(testthat)
> library(prepdat)
>
> test_check("prepdat")
Error: On CRAN
testthat results ================================================================
OK: 0 SKIPPED: 0 FAILED: 0
Execution halted
这就是我的测试文件的外观(这里是到GitHub的链接)
skip_on_cran()
图书馆(prepdat)
数据(“最终确定的数据”)
数据(“stroopdata”)
上下文(“最终确定的表格”)
test\u finalized\u stroopdata您在起重机上使用的skip\u不正确。它需要包含在test\u中,该块:
test_that("Finialized table is correct", {
skip_on_cran()
expect_equal(test_finalized_stroopdata, finalized_stroopdata)
})
您使用的skip\u-on\u-cran
不正确。它需要包含在test\u中,
块:
test_that("Finialized table is correct", {
skip_on_cran()
expect_equal(test_finalized_stroopdata, finalized_stroopdata)
})
我不清楚您的意图。是否希望在CRAN上跳过此操作?是的。在CRAN检查时失败,尽管我有skip_on_CRAN(),但我认为您需要在CRAN()上包含skip_
在你的测试中,测试代码块。你能试试吗?谢谢!在再次提交给CRAN之前,我应该运行更多检查吗?我不清楚你的意图。你想在CRAN上跳过这一点吗?是的。在CRAN检查中失败,尽管我已经跳过了CRAN上的检查()我想你需要包括跳过CRAN上的检查()
在您的测试中
代码块。您能试试吗?谢谢!在再次提交给CRAN之前,我应该运行更多检查吗?谢谢。除了context()
之外的所有代码都应该在测试中
可以在这里看到,谢谢。除了context()之外的所有代码
应该在测试单元的内部,如图所示