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

devtools::check() running infinite while devtools::test() running fine #567

Closed
pat-s opened this issue Jan 31, 2017 · 5 comments
Closed

Comments

@pat-s
Copy link
Contributor

pat-s commented Jan 31, 2017

When running devtools::test() on my package, everything works fine.

devtools::check() and R CMD check are running infinite on my tests. My tests are using two cores via foreach(). Is that causing trouble? If not, is there any way to debug this?

(Please use the dev branch for testing purposes.)

@xrobin
Copy link

xrobin commented Feb 5, 2017

I am running into exactly the same issue with one of my package right now.
I tried to isolate a minimal example and pushed it into xrobin/testParallel.
Basically, just opening and closing a cluster with a function such as the following is sufficient to trigger the infinite run:

startStopCluster <- function() {
	cl <- makeCluster(2)
	stopCluster(cl)
	return(1)
}

Commenting out test_check("testParallel") in tests/testthat.R in order to have the function tested outside of testthat is sufficient to have the tests finish quickly (indicating this is not a problem with R CMD check itself).

@gaborcsardi
Copy link
Member

This is the infamous R_TESTS catch. See https://github.com/xrobin/testParallel/pull/1/files#diff-3cf6fd2c31bb0259d6cfae004cdf115cR3 for the fix.

@xrobin
Copy link

xrobin commented Feb 5, 2017

This fixed the issue right away. It also shows how poor my googling skills are - even with the solution I can't really understand what's going on.
I hope it solves the problem for pat-s too.
Thanks a lot!

@pat-s
Copy link
Contributor Author

pat-s commented Feb 5, 2017

Wow, that solved the problem! How many hours did I spent on that...

Thanks so much!!!! @gaborcsardi

@michaelbarton
Copy link

Thank you, this solved this issue for me to. For anyone coming here from google. Add:

Sys.unsetenv("R_TESTS")

For testing parallel functions with testthat.

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

4 participants