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

source helper scripts in test environment when running `test_file` #350

Closed
jackwasey opened this Issue Jan 25, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@jackwasey
Contributor

jackwasey commented Jan 25, 2016

I have test harness data and functions in a helper-base.R file in tests/testthat/, andtest_file seems to rely on this being sourced manually, whereas test_package sets up a clean test environment.

Sourcing helper-base.R is a work-around, but pollutes the global environment, and I think it would be more consistent and simpler for test_file to source it for the user in a test environment.

@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 27, 2016

Can you use devtools::test(filter = "...") or testthat::test_package(filter = "...")?

@jackwasey

This comment has been minimized.

Contributor

jackwasey commented Jan 27, 2016

That's a good work-around, thanks for that. I think I'd still argue for test_file behaving in a similar way.

@hadley

This comment has been minimized.

Member

hadley commented Feb 19, 2016

That sounds reasonable to me

@hadley hadley closed this in 326a52c Feb 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment