tests: Resolved "Missing Random Number Generator" warnings#2911
Merged
tests: Resolved "Missing Random Number Generator" warnings#2911
Conversation
|
Performance benchmarks:
|
Contributor
Author
|
@EwoutH Please review my PR. |
Member
|
Thanks for the PR, nice and clean! @quaquel can you confirm this is the best practice on passing |
Member
|
looks good to me |
EwoutH
approved these changes
Dec 3, 2025
Member
|
@ShreyasN707 thanks! |
Contributor
Author
Sure I would be very happy to contribute more . |
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
Resolved "Missing Random Number Generator" warnings in the test suite by explicitly passing a random number generator to grid instantiations.
Bug / Issue
DiscreteSpace subclasses (such as OrthogonalMooreGrid, HexGrid, Network, and VoronoiGrid) emit a
UserWarning: Random number generator not specifiedwhen instantiated without a random parameter. This warning highlights potential non-reproducibility in models. The goal was to resolve these warnings within the project's tests.Implementation
Updated the following test files to explicitly pass
random=random.Random(42)during grid instantiation:This ensures that the tests are reproducible and eliminates the warnings.
Testing
Verified the fix by running the relevant tests using
pytest:pytest tests/test_discrete_space.py tests/test_space_renderer.py tests/test_space_drawer.py tests/test_solara_viz.pyAll tests passed successfully.
Additional Notes
No changes were made to the core library logic; only test files were modified to adhere to the requirement of explicit RNG specification.