Skip to content

Set a fixed random seed during testing#1056

Merged
mhucka merged 2 commits intomasterfrom
mh-fix-random-testing
Jun 3, 2025
Merged

Set a fixed random seed during testing#1056
mhucka merged 2 commits intomasterfrom
mh-fix-random-testing

Conversation

@mhucka
Copy link
Contributor

@mhucka mhucka commented Jun 2, 2025

Some of the tests became more flaky with the move to NumPy 2. In all cases, random numbers were involved at some point. Setting a fixed random seed made the tests reproducible and (so far) seems to have stopped the flakiness.

mhucka added 2 commits June 2, 2025 14:17
Some of the tests became more flaky with the move to NumPy 2. In all
cases, random numbers were involved at some point. Setting a fixed
random seed made the tests reproducible and (so far) seems to have
stopped the flakiness.
@mhucka mhucka requested review from dstrain115 and ncrubin June 2, 2025 22:00
@dstrain115
Copy link
Contributor

I suppose this is fine, but I am a tad worried we are sweeping some problems under the rug.

@mhucka
Copy link
Contributor Author

mhucka commented Jun 2, 2025

I suppose this is fine, but I am a tad worried we are sweeping some problems under the rug.

A fair point. What if we do this?

  • open an issue to flag this as a problem
  • use the global seed for now, so we can release OpenFermion with NumPy 2 support
  • fix the problem properly after the release

@dstrain115
Copy link
Contributor

SGTM.

@mhucka
Copy link
Contributor Author

mhucka commented Jun 2, 2025

SGTM.

Issue is #1060.

@mhucka mhucka added this pull request to the merge queue Jun 3, 2025
Merged via the queue into master with commit 5f5beee Jun 3, 2025
29 checks passed
@mhucka mhucka deleted the mh-fix-random-testing branch June 3, 2025 20:56
mhucka added a commit to mhucka/OpenFermion that referenced this pull request Sep 25, 2025
Some of the tests became more flaky with the move to NumPy 2. In all
cases, random numbers were involved at some point. Setting a fixed
random seed made the tests reproducible and (so far) seems to have
stopped the flakiness.
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