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
Contributor

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

@krlmlr krlmlr commented Jan 27, 2016

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

@jackwasey
Copy link
Contributor Author

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

@hadley 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants