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
Re-consider where helper files are sourced in load_all() #17
Comments
Comment by jimhester The problem is the helpers are sourced in the package environment, but @hadley maybe we should add a |
Comment by berndbischl
Cool that you are even fixing our package for us :) Thx a lot!
I would seriously suggest that. What happened on our side was that I wanted to show a student assistant how the mlr unit tests work. Apparently at that point in time we got the new devtools version on her laptop. After calling load_all on the package, and seeing the error, we had 3 technically competent people sitting around the laptop for 30 min thinking "wtf is happening". |
Comment by imanuelcostigan I have a package that creates some |
Comment by imanuelcostigan @hadley would you be open to me submitting a PR with the effect of sourcing the test helper files after running hooks? PS - |
Comment by hadley Sure |
Comment by berndbischl one other question from my side, that i just noticed. in the past, i also created a file called helper_zzz.R so i guess my question is: |
Comment by hadley @berndbischl maybe condition on |
Comment by jennybc It feels like part of the pain around test helpers is that they are used for setup but there's no similarly official way to do corresponding tear down. I have a faux test file named |
Comment by hadley What are you typically tearing down? |
Comment by jennybc OK this will be very specific. But I remove an OAuth token from an environment internal to the package. I delete some local files. I delete some things from Google Drive. |
Comment by hadley Maybe what we need for the non-idempotent stuff is to simply source a |
Comment by jennybc Is there something like |
Comment by hadley No, but that would be another approach - if you wanted to keep setup and tear down in the same file together. Could have something that allowed you to register setup and teardown code for each run. I'm thinking something like: register_test_something(
setup = file.create("x"),
teardown = unlink("x")
) |
Comment by berndbischl
we also run our unit tests in non-interactive mode via shell scripts / from the console. actually we do that most often. |
Comment by pitakakariki
I think |
Closed by #41 |
Issue by berndbischl
Thursday Apr 14, 2016 at 15:13 GMT
Originally opened as r-lib/devtools#1146
Your NEWS state this
In my setup I have a helper.R file, in tests/testthat which creates a few (data) objects I want to use in my unit tests (among other stuff).
You can reproduce the problem by creating a basically empty (but valid) package, then adding such a file under tests/testthat
This now breaks, after the new devtools update
mlbench would usually be in my SUGGESTS (and I want it to be there) but even adding it to DEPENDS and adding and explicit call to library("mlbench") in the helper.R does not remove the problem.
This now breaks our complete devel workflow.
Any advice?
The text was updated successfully, but these errors were encountered: