From 97dce751a968a772e94ea5895979c5cd1142fbe6 Mon Sep 17 00:00:00 2001 From: Min Yeol Lim Date: Thu, 6 Nov 2025 17:53:55 -0800 Subject: [PATCH] Add auto-retry for flaky PyPerf test to improve CI stability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test_dso_name_in_pyperf_profile test occasionally fails due to PyPerf timeouts, particularly with Python 2.7. This is caused by timing issues in CI environments where PyPerf may not generate profile files within the 5-second timeout. Changes: - Add pytest-rerunfailures==15.0 to dev-requirements.txt - Mark test_dso_name_in_pyperf_profile with @pytest.mark.flaky(reruns=3, reruns_delay=2) The test will now automatically retry up to 3 times with a 2-second delay between attempts, which should handle sporadic timeout issues while still catching genuine failures. Related issue: Sporadic test failure observed in CI runs Example failure: https://github.com/intel/gprofiler/actions/runs/19146096101/job/54734480910 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- dev-requirements.txt | 1 + tests/test_python.py | 1 + 2 files changed, 2 insertions(+) diff --git a/dev-requirements.txt b/dev-requirements.txt index c6a232c45..892172417 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,5 @@ pytest==8.3.5 +pytest-rerunfailures==15.0 flake8==7.2.0 black==25.1.0 mypy==1.15.0 diff --git a/tests/test_python.py b/tests/test_python.py index 3a1affd38..5535b9603 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -161,6 +161,7 @@ def test_python_matrix( assert profile.app_metadata["sys_maxunicode"] is None +@pytest.mark.flaky(reruns=3, reruns_delay=2) @pytest.mark.parametrize("in_container", [True]) @pytest.mark.parametrize("profiler_type", ["pyperf"]) @pytest.mark.parametrize("insert_dso_name", [False, True])