On 01/21/2013 04:01 AM, Davide Rambaldi wrote:

Hi all, here is  my followup:

The output of flowFit.Rcheck/tests/runTests.Rout is:

RUNIT TEST PROTOCOL -- Mon Jan 21 11:22:51 2013
***********************************************
Number of test functions: 0
Number of errors: 0
Number of failures: 0

1 Test Suite :
flowFit RUnit Tests - 0 test functions, 0 errors, 0 failures
Number of test functions: 0
Number of errors: 0
Number of failures: 0

No test run …. :-(

RESTARTING FROM SCRATCH with a package skeleton:
require(stats)
## two functions and two "data sets" :
f <- function(x, y) x+y
g <- function(x, y) x-y
d <- data.frame(a = 1, b = 2)
e <- rnorm(1000)
package.skeleton(list = c("f","g","d","e"), name = "RUnitTest")
And inside the package dir:

mkdir tests

mkdir -p inst/unitTests

touch inst/unitTests/test_iWantToFail.R

more inst/unitTests/test_iWantToFail.R

test_f <- function()
{
   checkTrue(FALSE)
}


OUTPUT is OK:

RUnitTest RUnit Tests - 1 test function, 0 errors, 1 failure
   FAILURE in test_f: Error in checkTrue(FALSE) : Test not TRUE


So where is the problem in my library?

After a session of "find the differences" game I finally got the problem:

Problem is in the .Rinstignore file.

here is my .Rinstignore in the ROOT directory of the package:

inst/doc/.*[.]bib$
inst/doc/Makefile
test/*
TODO
README
.DS_Store
.git/*
.project
.Rapp.history
.Rhistory


The problematic line is:

test/*

If I remove the line, the test runs and fail when need to fail with R CMD check:

R CMD check flowFit

[…]

Last 13 lines of output:
   flowFit RUnit Tests - 1 test function, 0 errors, 1 failure
   FAILURE in test_failing: Error in checkTrue(FALSE) : Test not TRUE


   Test files with failing tests

      test_iWantToFail.R
        test_failing


   Error in BiocGenerics:::testPackage("flowFit") :
     unit tests failed for package flowFit
   Execution halted


Strange thing: i put test/* in .Rinstignore, but R is ignoring the directory 
inst/unitTests/* is this the expected behavior?

Anyway, I can test now and I am happy :-)

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


As soon as I get some feedback about this error,  I will post an answer to my 
own question in stackoverflow:

http://stackoverflow.com/questions/14403181/r-developing-a-bioconductor-package-with-tdd-runit


Thanks for help.

If you need more info about my setup, here is the sessionInfo()

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

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] flowFit_0.3.1

loaded via a namespace (and not attached):
  [1] Biobase_2.18.0     BiocGenerics_0.4.0 feature_1.2.8      flowCore_1.24.0
  [5] gdata_2.12.0       gplots_2.11.0      graph_1.36.1       gtools_2.7.0
  [9] ks_1.8.11          kza_2.01           MASS_7.3-23        minpack.lm_1.1-6
[13] rrcov_1.3-02       stats4_2.15.2      tools_2.15.2


Regards

Davide Rambaldi







On Jan 18, 2013, at 6:43 PM, Martin Morgan wrote:

On 01/18/2013 08:26 AM, Davide Rambaldi wrote:
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()

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

?


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.ramba...@ieo.eu
[e] davide.ramba...@gmail.com

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel



--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793


        [[alternative HTML version deleted]]



_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel



--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to