stulacy / multistateutils

Utility funtions for parametric multi-state modelling in R
GNU General Public License v3.0
6 stars 2 forks source link

testthat causes R CMD check to fail #3

Closed rrrlw closed 6 years ago

rrrlw commented 6 years ago

The --no-build-vignettes option was used to allow R CMD build to succeed (see Issue #2 for more details on why R CMD build fails without that option). However R CMD check fails due to an ERROR with testthat (see screenshot below).

testthat failure

Part of this JOSS review.

rrrlw commented 6 years ago

I am slightly unsure about why this test is failing, because your Travis CI build appears clean. Let me know what your thoughts are, @stulacy?

(We can look at this after Issues #1 and #2, which, when solved, might fix this)

Edit: initial testing was done on Ubuntu 18, but was not reproduced on Windows 10 machine. Could be an artifact of my machine.

stulacy commented 6 years ago

I've been unable to replicate this on my Debian 8 machine. It does work on Travis but that's using 14.04. I tried to test it on Ubuntu on rhub (16.04) but I got an error there is no package called flexsurv but I cannot understand why it isn't available.

Is there another way I can test on a remote Ubuntu 18 install? I'd like to get to the bottom of this

rrrlw commented 6 years ago

I think rhub might only be installing packages in the Imports field of DESCRIPTION and flexsurv is in the Suggests field. I ran R CMD check multiple times on multiple machines and the above test (predict_transitions function) only failed on a subset of the runs - is there randomization involved in that test that could be causing it to fail? If so, using set.seed to ensure reproducibility might be a good fix (although I would still be worried about why a test is failing in certain conditions).

A quick note: the logical AND operator is only a single ampersand (&) in R instead of two (&&) as in the failing testthat statement pictured above. Could that be a source of error?

stulacy commented 6 years ago

I've identified 2 causes of the issue: the use of && and that the test was comparing relative error to a reference estimate, rather than absolute. I've corrected these now so it is testing the intended measure and should run for you.

rrrlw commented 6 years ago

Great! R CMD build and R CMD check look fine (although I would suggest switching webshot to Imports instead of Suggests).