-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[UnitTest] Fuzz based on seed rather than random value. #10515
[UnitTest] Fuzz based on seed rather than random value. #10515
Conversation
Some extensions to run tests in parallel (e.g. `pytest-xdist`) require that test collection be deterministic. Using the random seed as the test parameter instead of the random value makes the test collection be deterministic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM generally, but the test is not really random anymore right. You might as well just use fixed inputs?
Furthermore is this a general problem we have in the codebase? Do we want to be able to use xdist?
That's correct. I initially added this test to validate copying across a few orders of magnitude, and a fixed input size would work just as well. If we want to have the test be randomized per run, we could remove the call to Most of the other unit tests don't run into the xdist incompatibility, because they didn't change the name of the test being run. It only became an issue here because the seed value was included in the parametrized test name. I've found it really useful to be able to use xdist to speed up local test times. Other than some false positives from running out of GPU memory, most of the other tests are xdist-friendly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there was some discussion of using |
we want to add it since we have a lot of CPU headroom we're not using for tests in most cases, but there are a bunch of pitfalls like this waiting around that someone has to wade through and we haven't gotten around to it yet |
Some extensions to run tests in parallel (e.g. `pytest-xdist`) require that test collection be deterministic. Using the random seed as the test parameter instead of the random value makes the test collection be deterministic.
Some extensions to run tests in parallel (e.g.
pytest-xdist
) require that test collection be deterministic. Using the random seed as the test parameter instead of the random value makes the test collection be deterministic.