Skip to content

Commit 2ed92ec

Browse files
authored
Rerun flaky profiler tests on failure (#10035)
1 parent f0b3e0f commit 2ed92ec

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

requirements/test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
coverage>5.2.0
22
codecov>=2.1
33
pytest>=6.0
4+
pytest-rerunfailures>=10.2
45
check-manifest
56
twine==3.2
67
mypy>=0.900

tests/profiler/test_profiler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def simple_profiler():
5252
return SimpleProfiler()
5353

5454

55+
@pytest.mark.flaky(reruns=3)
5556
@pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])])
5657
def test_simple_profiler_durations(simple_profiler, action: str, expected: list):
5758
"""Ensure the reported durations are reasonably accurate."""
@@ -65,6 +66,7 @@ def test_simple_profiler_durations(simple_profiler, action: str, expected: list)
6566
np.testing.assert_allclose(simple_profiler.recorded_durations[action], expected, rtol=0.2)
6667

6768

69+
@pytest.mark.flaky(reruns=3)
6870
@pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])])
6971
def test_simple_profiler_iterable_durations(simple_profiler, action: str, expected: list):
7072
"""Ensure the reported durations are reasonably accurate."""
@@ -159,6 +161,7 @@ def advanced_profiler(tmpdir):
159161
return AdvancedProfiler(dirpath=tmpdir, filename="profiler")
160162

161163

164+
@pytest.mark.flaky(reruns=3)
162165
@pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])])
163166
def test_advanced_profiler_durations(advanced_profiler, action: str, expected: list):
164167

@@ -173,6 +176,7 @@ def test_advanced_profiler_durations(advanced_profiler, action: str, expected: l
173176
np.testing.assert_allclose(recored_total_duration, expected_total_duration, rtol=0.2)
174177

175178

179+
@pytest.mark.flaky(reruns=3)
176180
@pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])])
177181
def test_advanced_profiler_iterable_durations(advanced_profiler, action: str, expected: list):
178182
"""Ensure the reported durations are reasonably accurate."""

0 commit comments

Comments
 (0)