Skip to content

Commit

Permalink
gh-363: use pytest-rerunfailures for flaky test_ellipticity_gaussian (#…
Browse files Browse the repository at this point in the history
…371)

Rerun the flaky test if it fails. See
#364 (comment)

Closes: #363
  • Loading branch information
Saransh-cpp authored Oct 18, 2024
1 parent 0c39930 commit e797fe6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ test = [
"pytest-cov",
"pytest-doctestplus",
"pytest-mock",
"pytest-rerunfailures",
"scipy",
]

Expand Down
3 changes: 2 additions & 1 deletion tests/test_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def test_ellipticity_ryden04(rng: np.random.Generator) -> None:
assert np.all((e.real >= -1.0) & (e.real <= 1.0))


@pytest.mark.flaky(rerun=5, only_rerun=["AssertionError"])
def test_ellipticity_gaussian(rng: np.random.Generator) -> None:
n = 1_000_000

Expand All @@ -105,7 +106,7 @@ def test_ellipticity_gaussian(rng: np.random.Generator) -> None:
np.testing.assert_array_less(np.abs(eps), 1)

np.testing.assert_allclose(np.std(eps.real), 0.256, atol=1e-3, rtol=0)
np.testing.assert_allclose(np.std(eps.imag), 0.256, atol=1e-2, rtol=0)
np.testing.assert_allclose(np.std(eps.imag), 0.256, atol=1e-3, rtol=0)

eps = ellipticity_gaussian([n, n], [0.128, 0.256])

Expand Down

0 comments on commit e797fe6

Please sign in to comment.