Skip to content
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
Closed

source helper scripts in test environment when running test_file #350

jackwasey opened this issue Jan 25, 2016 · 3 comments

Comments

@jackwasey
Copy link

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
Copy link
Member

krlmlr commented Jan 27, 2016

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

@jackwasey
Copy link
Author

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

@hadley
Copy link
Member

hadley commented Feb 19, 2016

That sounds reasonable to me

@hadley hadley closed this as completed in 326a52c Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants