Closed BarkleyBG closed 6 years ago
There is a section "testthat files" in the existing vignette, is anything missing from there? Maybe it should be more visible, or the vignette needs a better structure? Either way, happy to review your PR!
I don't think anything is missing at all!
I opened the issue because the power and flexibility of rprojroot
and made it seem like the pkg was "too sophisticated" for the issue I was trying to solve, in a way. But what "sold" me on using this pkg was seeing that you had condensed dir(is_testthat$find_file("hierarchy", path = is_r_package$find_file()))
into a single function. So I think that providing a simple example like this would be great (in the name of evangelizing).
I can add my thoughts to the vignette. Should I PR to master, develop, or some other branch?
Thanks, master is fine (I just removed the develop branch).
If you're tinkering in the vignette ... if there are lots of reference files, it can be nice to create a folder for them and a helper function in helper.R
to fetch them. readxl maintains a zoo of weird workbooks and here's how I access them in tests:
@jennybc: Would a subdir
argument to make_fix_file()
help, or add confusion?
test_sheet <- rprojroot::is_testthat$make_fix_file(subdir = "sheets")
test_sheet
## function (...) {
## file.path("/.../rprojroot/tests/testthat", "sheets", ...)
## }
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
I thought the vignette was helpful. Perhaps some very short examples could also be helpful?
Here's a very short, concrete example that for the user would be:
rprojroot
I was able to get this working for my use case in one-line of code. I have a package and I have some baseline data for unit tests that I was storing in an .Rds file:
Previously, I had some if-then syntax for whether I was running interactively or via
devtools::test()
. Basically, I'd try to determine what the working directory was, and then specify the relative path from that; i think rprojroot does ~ exactly this, but with one line.So I replaced the above with the below:
I can write up a short vignette & start a PR if you'd like. Thanks for making my life better!