Closed purva-thakre closed 2 months ago
Noticed the same failure for windows-python 3.11
https://github.com/unitaryfund/mitiq/actions/runs/9766045422/job/26958119314?pr=2432#step:6:4325
The same failure on windows-python3.12
https://github.com/unitaryfund/mitiq/actions/runs/9765921429/job/26957722256#step:6:4326
I am unassigning this for myself because I cannot replicate this locally. My laptop does not have enough memory for local docker containers.
Looks like this is also happening on ubuntu: https://github.com/unitaryfund/mitiq/actions/runs/10267476608/job/28408109210?pr=2452#step:6:4486
Took a look at this in the mitiq coding call today and made some progress.
This test (in essence)
0
s and 1
sSome stats tell us the sum should fall in this range 99.94% of the time, meaning that on average we should see a value outside this range every 1,667 runs.
We considered the following solutions
np.random.choice
, it is not totally needed.Solution 1 was determined to be unnecessary since we still want this code's functionality to be tested with cases other than the rudimentary ones tested in this same test. Solution 2 was determined to not be a complete fix, as it is still possible for the test to fail, albeit much less likely. Solution 3 was deemed the best solution.
We ran the failing test on my machine (macos) on repeat 2000 times using the approach outlined here. We found it failed roughly at that cadence (1/2000 runs) which aligns with the math in the section above.
And just so no one else clashes here, I have a PR incoming.
Great investigation!
Noticed this failure twice in a CI run for Windows. If I rerun the test, it passes.
https://github.com/unitaryfund/mitiq/actions/runs/9748119578/job/26902405324?pr=2347#step:6:4326