Skip to content

set rng per test #268

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

Merged
merged 4 commits into from
Jun 17, 2025
Merged

set rng per test #268

merged 4 commits into from
Jun 17, 2025

Conversation

cvanelteren
Copy link
Contributor

@cvanelteren cvanelteren commented Jun 17, 2025

To ease the transition of #266 this PR adds just the changes to the tests and the local rng generator.

# using the same seed
from .conftest import SEED

np.random.seed(SEED)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a threading lock since we are modifying a global.

Copy link
Contributor Author

@cvanelteren cvanelteren Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't thread lock the layout within networkx, so this is fine as is I think as no two threads are accessing that function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me think of a better way to do this; otherwise we need to lock all functions that call graph

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think it is fixed now if we pass on seed explicitly to the functions that use rngs

Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 98.83721% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/tests/test_2dplots.py 96.15% 2 Missing ⚠️
ultraplot/tests/test_colorbar.py 96.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren cvanelteren added this to the v1.57.1 milestone Jun 17, 2025
@cvanelteren
Copy link
Contributor Author

From my viewing of the results, the results only differ in the random data. This PR and #266 would self correct as it would clean up the mess on main.

@beckermr beckermr enabled auto-merge (squash) June 17, 2025 19:57
@beckermr beckermr disabled auto-merge June 17, 2025 19:57
@beckermr beckermr merged commit bf61104 into Ultraplot:main Jun 17, 2025
16 of 25 checks passed
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

Successfully merging this pull request may close these issues.

2 participants