From 2ed92ecabb252778ea339eeeb8f6b536f542ac68 Mon Sep 17 00:00:00 2001 From: kingyiusuen Date: Wed, 20 Oct 2021 08:27:04 -0500 Subject: [PATCH] Rerun flaky profiler tests on failure (#10035) --- requirements/test.txt | 1 + tests/profiler/test_profiler.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/requirements/test.txt b/requirements/test.txt index 8d0e0712d7..0e39d0821c 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,6 +1,7 @@ coverage>5.2.0 codecov>=2.1 pytest>=6.0 +pytest-rerunfailures>=10.2 check-manifest twine==3.2 mypy>=0.900 diff --git a/tests/profiler/test_profiler.py b/tests/profiler/test_profiler.py index 9e22c3f8ec..6528c39e2a 100644 --- a/tests/profiler/test_profiler.py +++ b/tests/profiler/test_profiler.py @@ -52,6 +52,7 @@ def simple_profiler(): return SimpleProfiler() +@pytest.mark.flaky(reruns=3) @pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])]) def test_simple_profiler_durations(simple_profiler, action: str, expected: list): """Ensure the reported durations are reasonably accurate.""" @@ -65,6 +66,7 @@ def test_simple_profiler_durations(simple_profiler, action: str, expected: list) np.testing.assert_allclose(simple_profiler.recorded_durations[action], expected, rtol=0.2) +@pytest.mark.flaky(reruns=3) @pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])]) def test_simple_profiler_iterable_durations(simple_profiler, action: str, expected: list): """Ensure the reported durations are reasonably accurate.""" @@ -159,6 +161,7 @@ def advanced_profiler(tmpdir): return AdvancedProfiler(dirpath=tmpdir, filename="profiler") +@pytest.mark.flaky(reruns=3) @pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])]) def test_advanced_profiler_durations(advanced_profiler, action: str, expected: list): @@ -173,6 +176,7 @@ def test_advanced_profiler_durations(advanced_profiler, action: str, expected: l np.testing.assert_allclose(recored_total_duration, expected_total_duration, rtol=0.2) +@pytest.mark.flaky(reruns=3) @pytest.mark.parametrize(["action", "expected"], [("a", [3, 1]), ("b", [2]), ("c", [1])]) def test_advanced_profiler_iterable_durations(advanced_profiler, action: str, expected: list): """Ensure the reported durations are reasonably accurate."""