Skip to content

system quoting fails with testthat + CMD check #144

@scottkosty

Description

@scottkosty

Below is a minimal example:

Put the following in tests/testthat.R:

options(warn = 2)
library(testthat)
test_check("anRpackage", report = "summary")

In tests/testthat/test.R

extcmd <- 'R -e \'print("hello")\''
system(extcmd, intern = TRUE)

Then run R CMD check (either with 3.1 or with the current devel version), I get the following error:

* checking tests ...
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  > library(testthat)
  > 
  > test_check("anRpackage", report = "summary")
  Loading required package: anRpackage
  Error in file(filename, "r", encoding = encoding) : 
    cannot open the connection
  Calls: local ... eval.parent -> eval -> eval -> eval -> eval -> source -> file
  In addition: Warning message:
  In file(filename, "r", encoding = encoding) :
    cannot open file 'startup.Rs': No such file or directory
  Execution halted
  Error: (converted from warning) running command 'R -e 'print("hello")'' had status 1
  Execution halted

If I source test.R or run R CMD BATCH test.R or put test.R directly in the tests folder and then run R CMD check, it runs fine.

The error is similar to #129 and #86.

I'm using Ubuntu 64-bit, both 13.10 and 14.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions