Вопрос

I am trying to follow the BioConductor RUnit guidelines. 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)
Это было полезно?

Решение 2

Problem solved.

Here is the story:

I my package I putted a .Rinstignore file with this line:

test/* 

I was expecting glob-style matching (like .gitignore) but instead, as RShowDoc("R-exts") say:

.Rinstignore does perl-style regular expression matching.

So, my rule test/* was interpreted by R as:

Ignore all files starting with test followed by 0 or more '/' 

(the part /* was interpreted as match zero or more / characters)

A quick check with grep show how this work:

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

Removing the line

test/* 

from .Rinstignore solved the problem.

Другие советы

I do not know the BioC guidelines on this but I have a number of CRAN packages which use the scheme first developed by Martin Maechler for some Rmetrics packages.

It is described in this R Wiki post, and you could look at my variations of this in, say, RcppArmadillo or RcppGSL or some other packages. The key is often a file tests/doRUnit.R which does the necessary pivoting to be run from sources, or from the installed package.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top