dimanche 8 avril 2018

R package testing with covr and Travis, Error in path.expand(path) : invalid 'path' argument

I'm getting the following error with using the function covr::package_coverage(), which is used to exclude certain lines in the source code. The code to exclude specific lines is detailed in the README:

https://cran.r-project.org/web/packages/covr/README.html

The line_exclusions argument to package_coverage() can be used to exclude some or all of a file. This argument takes a list of filenames or named ranges to exclude.

# exclude whole file of R/test.R
package_coverage(line_exclusions = "R/test.R")

# exclude lines 1 to 10 and 15 from R/test.R
package_coverage(line_exclusions = list("R/test.R" = c(1:10, 15)))

# exclude lines 1 to 10 from R/test.R, all of R/test2.R
package_coverage(line_exclusions = list("R/test.R" = c(1, 10), "R/test2.R"))

Here is the line which I am including in my Travis config, which appears to follow the README:

after_success:
  - Rscript -e 'covr::codecov(covr::package_coverage(line_exclusions = list("R/ffTrack.R" = c(328:744))))'

https://github.com/mskilab/ffTrack/blob/master/.travis.yml

This results in the following error on Travis:

https://travis-ci.org/mskilab/ffTrack/builds/356201596

$ Rscript -e 'covr::codecov(covr::package_coverage(line_exclusions = list("R/ffTrack.R" = c(328:744))))'
Error in path.expand(path) : invalid 'path' argument
Calls: <Anonymous> ... as_package -> normalize_path -> normalizePath -> path.expand
Execution halted

I do not understand the source of this bug. Am I using the function incorrectly maybe?

Aucun commentaire:

Enregistrer un commentaire