Skip to content

[Bioc-devel] R: developing a bioconductor package with TDD (RUnit)

4 messages · Davide Rambaldi, Martin Morgan

#
Hello, I am trying to follow the bioconductor RUnit guidelines (http://www.bioconductor.org/developers/unitTesting-guidelines/#duringDevelopment)

I have followed the the minimal setup so I have:

Suggests: RUnit, BiocGenerics in DESCRIPTION

BiocGenerics:::testPackage("MyPackage") in MyPackage/tests/runTests.R

and some test_XXX.R files in MyPackage/inst/unitTests/

If I run a single test files with:

library(RUnit)
source("LIBRARY FILES")
source("MyPackage/inst/unitTests/test_getKeywordValue.R")
test_getKeywordValue()

The test run (and fails when need to fail), but if I run

R CMD check MyPackage

The command say:

* checking tests ...
  Running ?runTests.R?
 OK

But don't run my tests in MyPackage/inst/unitTests directory...

What I missing?

Platform: x86_64-apple-darwin9.8.0 
R version 2.15.2 (2012-10-26)

Best Regards and thanks in Advance


-----------------------------------------------------------
PLEASE NOTE MY NEW EMAIL ADDRESS
-----------------------------------------------------------

-----------------------------------------------------
Davide Rambaldi, PhD.
-----------------------------------------------------
IEO ~ MolMed
[e] davide.rambaldi at ieo.eu
[e] davide.rambaldi at gmail.com
#
On 01/18/2013 08:26 AM, Davide Rambaldi wrote:
To me this looks ok. Are you using R-devel and current packages (output of 
sessionInfo())? After installing your package, does

  R --vanilla -e " BiocGenerics:::testPackage('MyPackage')"

do the right thing? After running R CMD check, are there any hints in the file

   MyPackage.Rcheck/tests/runTests.Rout

?

  
    
2 days later
#
On 01/21/2013 04:01 AM, Davide Rambaldi wrote:
Glad you sorted that out. RShowDoc("R-exts") says that .Rinstignore does 
perl-style regular expression matching. The '/*' part of your pattern says 
'match zero or more / characters' whereas you were probably expecting glob-style 
matching, '/' followed by anything. The Writing R Extensions manual says, in a 
footnote, that the pattern matching is case-insensitive on Windows (probably 
this isn't a good design decision, but beside the point), which would NOT 
exclude unitTests on your MacOS but would exclude the individual test_.*R files

 > grep("test/*", c("inst/unitTests/bar", "inst/unitTests/test_bar.R"),
        perl=TRUE)
[1] 2

So yes, it would seem like you were getting what you asked for!

Martin