5

My first [r] post! I've taken over a project developed by a software house which consists of 4 R packages. When running through the tests I discover that whilst devtools::test() produces a clean run for one of the packages, devtools::check() does not!

The error is as below in the output:

    > test_check("moment")
  Error in file(file, "rt") : cannot open the connection
  Calls: test_check ... FUN -> eval -> eval -> read.csv -> read.table -> file
  In addition: Warning message:
  In file(file, "rt") :
    cannot open file 'Tables/Analysis/BobAndCheck/bob.csv': No such file or directory
  Execution halted

Note that the csv file referred to is one of many csv files used to manage testthat input and expected output. It seems that when running devtools::check() the whole package (including these files) is copied to the TMPDIR location. What is odd is that the "BobAndCheck" folder is not copied (even though other folders containing similar csv files are). So the error is correct, the test file is NOT there (in the TMPDIR), but I have no idea why it is not being copied when others are! Note the top level "Tables" sits directly under the tests/testthat folder in the package structure.

I can't find any docs on why check() copies the files to the TMPDIR to run the tests (a clean package?), and no way to understand why this might go wrong!???

Any help much appreciated. Thanks.

Edited to include ignore file below (I don't believe this is causing the issue):

^.*\.Rproj$
^\.Rproj\.user$
^ReceivedV[0-9]$
^ReceivedV[0-9]MangoMod$

Edited (2) - to add that the tar file the project generates (package?) is 36.1MB. Could the size be an issue here?

W. Doe
  • 51
  • 2
  • can you please check `.Rbuildignore` file, see also: https://stackoverflow.com/questions/13182634/rbuildignore-and-excluding-directories – Bulat Mar 11 '19 at 22:09
  • Thanks Bulat - that is a valid question. I had checked that file but I don't believe it contains anything that would ignore this folder (see below). I will go off and read up on the format though as admit to not fully understanding it! – W. Doe Mar 12 '19 at 07:20
  • Added ignore file to main post as couldn't format in comment! – W. Doe Mar 12 '19 at 07:29
  • Tearing my hair out with this one - seems to be no way to get insight into the process that creates the package and copies the files. Will have to live with the error as it has beaten me! – W. Doe Mar 12 '19 at 15:50
  • Have you seen this question: [testthat fails within devtools::check but works in devtools::test](https://stackoverflow.com/q/41846465/8366499)? – divibisan Mar 14 '19 at 21:42
  • I have seen that and I'm afraid it's not relevant. As I hope is clear above. I know the cause of the issue. The csv file is not being built into the tar package. So if I run the test against the folder it works as the csv is there. when I run devtools::check, this checks the tar file which then fails as the csv is not included in the package (despite others being successfully added!). This issue happens on my local build and a docker driven linux setup so I know it's not just a quirk of one machine! – W. Doe Mar 15 '19 at 12:14

0 Answers0