2016-09-22 65 views
0

我將我的包提交給了CRAN,並且未通過CRAN R CMD檢查。 這是他們得到了錯誤:由於使用testthat進行測試,CRAN上的包失敗

* 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

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) 
}) 

我怎樣才能解決這個鏈接

任何?幫助將非常感激,

Ayala

+0

您的意圖對我而言並不清楚。你想在CRAN上跳過這個嗎? –

+0

是的。它在CRAN檢查上失敗,雖然我有skip_on_cran() – ayalaall

+1

我認爲你需要在'test_that'代碼塊中包含'skip_on_cran()'。你可以試試嗎? –

回答

1

您錯誤地使用skip_on_cran。它需要包含在您的test_that區塊中:

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

謝謝。除'context()'之外的所有代碼都應該放在'test_that'裏面,可以在這裏看到https://github.com/ayalaallon/prepdat/blob/master/tests/testthat/test_prep.R – ayalaall

相關問題