I'd like to test those files with testthat to ensure they have the right structure.
Currently, I can only read those files during the tests if I specify the full path ("~/path_to_project/project/data/foo.parquet"). I'm wondering if there's a way to use paths relative to the project instead (i.e. "data/foo.parquet"). I use devtools::test() to run the tests. I want to keep the parquet files outside of testthat/ directory.
If your tests are in tests/testthat, then testthat::test_path() should always refer to that directory, so if you use devtools::test() then you should be able to find your data files with
testthat::test_path("../../data/foo.parquet")
etc.
testthat is aimed at packages, so this might not work without adding a top level DESCRIPTION file, that has a Package and a Version entry.
I've just learned something new. I thought ../ could only be used at the beginning of the path to access the parent directory and that tests/testthat/../../data/foo.parquet would just look for folders called ...
I do have a DESCRIPTION file. The project is actually a package with additional (non-conventional) directories and files. I created a post about that a few days ago. I ended up experimenting.
@vedoa
The main problem with using absolute paths here is that the tests will break whenever I run them on a different machine or different file structures. I could probably get away with getwd() but I find the test_path() and relative paths solution more elegant.