Skip to content
Prev 3693 / 21307 Next

[Bioc-devel] Debugging when test case passes in interactive session but fails R CMD check

Hi Cory,
On Wed, Sep 26, 2012 at 8:19 PM, Cory Barr <barr.cory at gene.com> wrote:
Yes. When you run R CMD check, you are actually running a script
called "check" which can be found somewhere in R_HOME (exact location
varies depending on platform), which looks like this:

echo 'tools:::.check_packages()' | R_DEFAULT_PACKAGES= LC_COLLATE=C
"${R_HOME}/bin/R" --no-restore --slave --args ${args}

So you can simulate that with:

R_DEFAULT_PACKAGES= LC_COLLATE=C R --no-restore  --vanilla

Then in R:

tools:::.check_packages("myPkg") # you need to be in the right directory

Also, I'd be curious whether
R -f myPkg/tests/*.R
would also reproduce the error.

Or, in R:
library(RUnit)
source("mypkg/inst/unitTests/test_my_test_file.R")
test_name_of_my_test_function()
Are you using something other than tempfile() to create the temp
files? If so, do you get different results if you use tempfile()?
Let us know if the above helps.

Dan
Message-ID: <CAF42j23Hpw-3Wkpr1EmVHH_W79V6X3462KPoLev5FbFDzvi9pA@mail.gmail.com>
In-Reply-To: <9894_1348716032_5063C600_9894_4832_1_CAOaCkPNur9Ykg3OWAotjfnp+3HEpi-_2TP0ir_o3QsFm8H7Urg@mail.gmail.com>