Using paths relative to the root of a project in tests

@Gabor
Thanks, that works perfectly.

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.

1 Like