首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于使用testthat进行测试,在CRAN上的包失败

由于使用testthat进行测试,在CRAN上的包失败
EN

Stack Overflow用户
提问于 2016-09-22 23:37:32
回答 1查看 371关注 0票数 0

我向CRAN提交了我的包,但它没有通过CRAN R CMD检查。这是他们得到的错误:

代码语言:javascript
复制
* 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 https://github.com/ayalaallon/prepdat的链接

代码语言:javascript
复制
skip_on_cran()
library(prepdat)
data("finalized_stroopdata")
data("stroopdata")

context("Finalized table")

test_finalized_stroopdata <- prep(
  dataset = stroopdata
  , file_name = NULL
  , file_path = NULL
  , id = "subject"
  , within_vars = c("block", "target_type")
  , between_vars = c("order")
  , dvc = "rt"
  , dvd = "ac"
  , keep_trials = NULL
  , drop_vars = c()
  , keep_trials_dvc = "raw_data$rt > 100 & raw_data$rt < 3000 & raw_data$ac     == 1"
  , keep_trials_dvd = "raw_data$rt > 100 & raw_data$rt < 3000"
  , id_properties = c()
  , sd_criterion = c(1, 1.5, 2)
  , percentiles = c(0.05, 0.25, 0.75, 0.95)
  , outlier_removal = 2
  , keep_trials_outlier = "raw_data$ac == 1"
  , decimal_places = 0
  , notification = TRUE
  , dm = c()
  , save_results = FALSE
  , results_name = "results.txt"
  , results_path = NULL
  , save_summary = FALSE
)

test_that("Finialized table is correct", {
  expect_equal(test_finalized_stroopdata, finalized_stroopdata)
})

我该如何解决这个问题呢?

任何帮助都将不胜感激,

阿亚拉

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-26 17:56:06

您错误地使用了skip_on_cran。它需要包含在您的test_that块中:

代码语言:javascript
复制
test_that("Finialized table is correct", {
  skip_on_cran()
  expect_equal(test_finalized_stroopdata, finalized_stroopdata)
})
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39643321

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档