-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is calling test_path()
at a global level within a helper-*.R
file not supported?
#1562
Comments
That might not work, depending which test function you use. E.g. |
Do you think it is a bug? Maybe a devtools bug? If not, I am happy to close this since we have workarounds |
I don't think a bug, it is a consequence of how devtools + testthat work together. It would also be rather inconvenient to consider it a bug, because I am not sure if there is a way to fix it. |
That is what I figured, good enough for me! |
@gaborcsardi I encounter this too. |
Its manual says:
I guess we could say that it works in test files, but not in helper files. Do you want to submit a PR? |
In the censored package we had a
helper-
file that loaded some helper data objects withtest_path()
andreadRDS()
. Like this:https://github.com/tidymodels/censored/pull/145/files#diff-86973057dbc44244492fcd424b56710d5bccdab7c751ca7d469b4c744f85606aL1
It turns out that this doesn't work. You can easily reproduce with this repo:
https://github.com/DavisVaughan/testthathelperpath
Just do
load_all()
, which errors with:There are lots of ways to work around this, but I was a bit surprised that this didn't work so we figured it was best to open an issue
The text was updated successfully, but these errors were encountered: