Use local RNG in MultiTensor tests - #1439
Open
fzlzjerry wants to merge 1 commit into
Open
Conversation
Give each randomized MultiTensor test a fresh, reproducible NumPy Generator instead of consuming the legacy global random state. This is an incremental step toward removing the suite-wide seed without destabilizing unrelated tests.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the test suite in _multitensor_test.py to use a deterministic random number generator. It introduces a pytest fixture rng utilizing np.random.default_rng(0) and updates all test functions to use this fixture instead of calling np.random.random directly. There are no review comments to process, and I have no additional feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
numpy.random.GeneratorRationale
This is an incremental part of #1060. It makes the ten randomized tests in
_multitensor_test.pyisolated and reproducible without changing random behavior elsewhere in the suite.Validation
check/all --only-changed-files origin/main(2287 passed; formatting, Pylint, mypy, incremental coverage, ShellCheck, and notebook formatting all passed)44 passed)pytest-randomlyseeds1,42, and4294967295(10 passedfor each seed)np.random.randompatched to raise on use (10 passed)