I currently writing tests for an R package using
testthat, the standard library for writing tests in R.
All the tests are currently in a single script
all_tests.R within the
testthat subdirectory. When I run the entire script
all_tests.R or each individual function, all code runs without any errors. If there were any "warnings", I used
When I build and check the package manually with the commands
R CMD build package_name R CMD check package_name.tar.gz ## the tar.gz file is the output of R CMD build
there are no errors. The
00check.log shows nothing, as far as I can see.
However, the build from Travis-CI consistently fails. Here is an example:
... testthat results ================================================================ OK: 521 SKIPPED: 0 FAILED: 9 1. Error: function1 (@all_tests.R#194) 2. Error: function2 (@all_tests.R#247) 3. Error: function3 (@all_tests.R#269) 4. Error: function4 (@all_tests.R#385) 5. Error: function5 (@all_tests.R#353) 6. Error: function6 (@all_tests.R#716) 7. Error: function7 (@all_tests.R#744) 8. Error: function8 (@all_tests.R#787) 9. Error: function9 (@all_tests.R#832)
In order to get more information to try to resolve this issue, I added this line in
script: - R CMD build . - R CMD check *tar.gz - cat /home/travis/build/repo/package_name/package_name.Rcheck/00check.log
In the Travis-CI Job log, I see
The command "cat /home/travis/build/repo/package_name/package_name.Rcheck/00check.log " exited with 0
but that is not very helpful.
(1) How could I resolve this issue? Naturally, I could comment out each of these tests, but I don't understand why these are failing.
(2) What is the correct way to properly view why function1, function2, etc. are failing?