[Rprotobuf-yada] package ready or unit tests

Dirk Eddelbuettel edd at debian.org
Sat Dec 26 16:41:08 CET 2009


On 26 December 2009 at 13:26, Romain François wrote:
| I've added bits and pieces (inspired from how the fUtilities package 
| does it) to prepare the package for unit testing.

Nice. I like that setup too. But it fails 'R CMD check' from SVN and that
sucks:

* checking tests ...
  Running ‘doRUnit.R’
 ERROR
Running the tests in 'tests/doRUnit.R' failed.
Last 13 lines of output:
  +   pkg <- sub("\\.Rcheck$", '', basename(dirname(wd)))
  +
  +   library(package=pkg, character.only=TRUE)
  +
  +   path <- system.file("unitTests", package = pkg)
  +
  +   stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
  +
  +   source(file.path(path, "runTests.R"), echo = TRUE)
  + }
  Error in library(package = pkg, character.only = TRUE) :
    there is no package called 'pkg'
  Execution halted
edd at ron:~/svn/rprotobuf$

That was running 'R CMD check pkg' as pkg/ is the subdir.  

The best fix I ever found for that was to ... hardcode the package name
above.  Which feels like a crutch. Can you think of anything better?

| The RProtoBuf-unitTests vignette has been resurrected and now will run 
| the unit tests and fetch the text results (not that exciting, but this 
| will do just fine [1]) into the vignette.
| 
| tests are stored in runit.*.R files in the inst/unitTests directory
| 
| so all we have to do to run the unit tests is to run R CMD build pkg

One I change to 

  #wd <- getwd()
  #pkg <- sub("\\.Rcheck$", '', basename(dirname(wd)))
  pkg <- "RProtoBuf"

it passes but doesn't build the vignette.
 
| Now we need to populate the tests.

Yup. 

Dirk

-- 
Three out of two people have difficulties with fractions.


More information about the Rprotobuf-yada mailing list