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

Reseed RNG before each test #833

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link

This ensure that for a given --seed value, a test will always start from the same seed.

Otherwise previous tests using the RNG, would leak state.

This is something we had for a very long time as a global setup, I figured it made sense upstream.

A recent commit to ruby reminded me of it: ruby/ruby@7c1553e

This ensure that for a given `--seed` value, a test
will always start from the same seed.

Otherwise previous tests using the RNG, would leak state.
@zenspider
Copy link
Collaborator

I dunno about this one. I suspect it'll break a lot of tests out there.

I have sranded before shuffling classes and methods for each runnable so that will stabilize that aspect (previously user/test use of srand could throw run order off)...

without more analysis to show that this won't "break the world" I think I'd rather leave it up to the user/test to do it themselves. I've added Minitest.seed in order to make this more readily available.

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

Successfully merging this pull request may close these issues.

None yet

3 participants