簡體   English   中英

僅為測試加載testthat包,但不要求依賴

[英]Loading the testthat package only for tests but not requiring in dependencies

構建包會導致以下警告:

* checking for unstated dependencies in tests ... WARNING
‘library’ or ‘require’ call not declared from: ‘testthat’
* checking tests ...
  Running ‘test-all.R’
 OK
* checking PDF version of manual ... OK
WARNING: There was 1 warning.

包目錄有一個名為tests的文件夾,文件為test-all.R:

library(testthat)
library(bootLR)

test_package("bootLR")

然后是一個子文件夾testthat其中包含兩個包含各種測試的文件。

錯誤消息可能告訴我,我沒有在DESCRIPTION文件中聲明testthat,但我不想要求最終用戶安裝它,我相信將library(testthat)語句放在test-all中。 R文件來自testthat手冊。

任何方式,或者我必須以正確的方式添加它(強制用於安裝testthat)?

編輯:我想將它添加到Suggests:可能是最好的方法嗎?

也許建議? 按照哈德利的說法

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM