以下は最小限の例です。
以下をtests / testthat.Rに入れてください:
options(warn = 2)
library(testthat)
test_check("anRpackage", report = "summary")
tests / testthat /test.Rで
extcmd <- 'R -e \'print("hello")\''
system(extcmd, intern = TRUE)
次に、 R CMD check
実行すると(3.1または現在の開発バージョンのいずれかで)、次のエラーが発生します。
* checking tests ...
Running ‘testthat.R’
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
> library(testthat)
>
> test_check("anRpackage", report = "summary")
Loading required package: anRpackage
Error in file(filename, "r", encoding = encoding) :
cannot open the connection
Calls: local ... eval.parent -> eval -> eval -> eval -> eval -> source -> file
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
cannot open file 'startup.Rs': No such file or directory
Execution halted
Error: (converted from warning) running command 'R -e 'print("hello")'' had status 1
Execution halted
test.R
か、 R CMD BATCH test.R
実行するか、 test.R
をtests
フォルダーに直接入れてtest.R
R CMD check
を実行すると、正常に実行されます。
エラーは#129と#86に似ています。
13.10と14.04の両方のUbuntu64ビットを使用しています。
それはRです。 tests/
ファイルを介してsystem("R CMD build ...")
を試してみると、同じ問題が発生します-テストは含まれていません(そしてGoogle経由でここに到達しました...)
Ubuntu 14.04、R3.1.0。
知っておくと、ダーク。 それでは、この問題を閉じましょう。
Noooo-私も修正したい:-/ devtoolsまたはtestthatまたはyouknowhatによってくすぐられるかどうかに直交する修正を見つける必要があります。
私は同意しますが、あなたの新しい情報から、これはRの問題のように聞こえますが、その問題のテストではありませんか? 私は確かにこのバグを開いたままにしておくことを気にしませんが、私が推測する回避策を考慮しない限り、その作者が実際に実行できないバグでテストを乱雑にしたくありません。
これをRコアに報告してそこで対処したほうがいいと思いませんか?
これはRの問題です。 devtoolsには、(環境変数の設定のコンテキストで)次のものがあります。
# When R CMD check runs tests, it sets R_TESTS. When the tests
# themeselves run R CMD xxxx, as is the case with the tests in
# devtools, having R_TESTS set causes errors because it confuses
# the R subprocesses. Unsetting it here avoids those problems.
"R_TESTS" = "",
追加することを確認するためにここに来ました
Sys.setenv("R_TESTS" = "")
テストファイルにこれらの問題を処理しているようです。
これはRコアに報告されていますか? もしそうなら、どこ? ありがとう。
最も参考になるコメント
これはRコアに報告されていますか? もしそうなら、どこ? ありがとう。