Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Re-consider where helper files are sourced in load_all() #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.
changed the title from
devtools 1.11.0 looad_all breaks if data is called in testthat helper files
devtools 1.11.0 load_all breaks if data is called in testthat helper files
Apr 14, 2016
added a commit
Apr 14, 2016
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".
I have a package that creates some
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:
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") )