Skip to content

Commit

Permalink
TST: Ensure test is identical in all runs
Browse files Browse the repository at this point in the history
Use a randomstate to ensure that the test is identical in all runs
Avoids random failures on travis
  • Loading branch information
bashtage committed May 1, 2019
1 parent 5d42380 commit b9a1de5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions statsmodels/stats/libqsturng/tests/test_qsturng.py
Expand Up @@ -186,9 +186,10 @@ def test_handful_to_known_values(self):
@pytest.mark.slow
def test_100_random_values(self, reset_randomstate):
n = 100
ps = np.random.random(n)*(.999 - .1) + .1
rs = np.random.randint(2, 101, n)
vs = np.random.random(n)*998. + 2.
random_state = np.random.RandomState(12345)
ps = random_state.random_sample(n)*(.999 - .1) + .1
rs = random_state.randint(2, 101, n)
vs = random_state.random_sample(n)*998. + 2.
qs = qsturng(ps, rs, vs)
estimates = psturng(qs, rs, vs)
actuals = 1. - ps
Expand Down

0 comments on commit b9a1de5

Please sign in to comment.