Closed shenganzhang closed 2 years ago
Thanks for this! I was unable to reproduce with multiple Python versions and running the tests multiple times in quick succession. But I don't doubt that there may be an issue here as pytest does some non-obvious things when setting up tests, so setting the random seed within the test itself seems safer than doing it within the module.
This PR aims to fix the flaky test
tests/test_layout.py::test_rearrange
. In previous versions, the test will run into randomly inrearrange(t, model.random_order)
case. And the reason is that the globally definedrandom.seed(1)
seems not working well here, so I define the seed inside that test case. The test failure can be reproduced by runningpytest
possibly for multiple times. Notice that the PR is modifying the test to make it more robust without changing the source code.