Skip to content

Commit bc33f3b

Browse files
Switch from flaky to pytest-rerunfailures for test retries
The flaky plugin doesn't work with async tests — it never retries them. Meanwhile, pytest-rerunfailures (pulled in by deepeval) was hijacking the @pytest.mark.flaky marker and defaulting to 1 rerun because it doesn't understand max_runs. The two plugins conflict on the same firstresult hook. Replace all max_runs=3 with reruns=2 (same 3 total attempts), disable the flaky plugin, and remove it from dependencies.
1 parent 17be383 commit bc33f3b

File tree

11 files changed

+1034
-1046
lines changed

11 files changed

+1034
-1046
lines changed

tests/admin_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def grafana_team():
7171

7272

7373
@pytest.mark.parametrize("model", models)
74-
@pytest.mark.flaky(max_runs=3)
74+
@pytest.mark.flaky(reruns=2)
7575
async def test_list_users_by_org(
7676
model: str,
7777
mcp_client: ClientSession,
@@ -97,7 +97,7 @@ async def test_list_users_by_org(
9797

9898

9999
@pytest.mark.parametrize("model", models)
100-
@pytest.mark.flaky(max_runs=3)
100+
@pytest.mark.flaky(reruns=2)
101101
async def test_list_teams(
102102
model: str,
103103
mcp_client: ClientSession,

tests/clickhouse_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@pytest.mark.parametrize("model", models)
11-
@pytest.mark.flaky(max_runs=3)
11+
@pytest.mark.flaky(reruns=2)
1212
async def test_clickhouse_list_tables(
1313
model: str,
1414
mcp_client: ClientSession,
@@ -36,7 +36,7 @@ async def test_clickhouse_list_tables(
3636

3737

3838
@pytest.mark.parametrize("model", models)
39-
@pytest.mark.flaky(max_runs=3)
39+
@pytest.mark.flaky(reruns=2)
4040
async def test_clickhouse_describe_table(
4141
model: str,
4242
mcp_client: ClientSession,
@@ -64,7 +64,7 @@ async def test_clickhouse_describe_table(
6464

6565

6666
@pytest.mark.parametrize("model", models)
67-
@pytest.mark.flaky(max_runs=3)
67+
@pytest.mark.flaky(reruns=2)
6868
async def test_clickhouse_query_logs(
6969
model: str,
7070
mcp_client: ClientSession,

tests/cloudwatch_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@pytest.mark.parametrize("model", models)
11-
@pytest.mark.flaky(max_runs=3)
11+
@pytest.mark.flaky(reruns=2)
1212
async def test_cloudwatch_list_namespaces(
1313
model: str,
1414
mcp_client: ClientSession,
@@ -33,7 +33,7 @@ async def test_cloudwatch_list_namespaces(
3333

3434

3535
@pytest.mark.parametrize("model", models)
36-
@pytest.mark.flaky(max_runs=3)
36+
@pytest.mark.flaky(reruns=2)
3737
async def test_cloudwatch_list_metrics(
3838
model: str,
3939
mcp_client: ClientSession,
@@ -58,7 +58,7 @@ async def test_cloudwatch_list_metrics(
5858

5959

6060
@pytest.mark.parametrize("model", models)
61-
@pytest.mark.flaky(max_runs=3)
61+
@pytest.mark.flaky(reruns=2)
6262
async def test_cloudwatch_query_metrics(
6363
model: str,
6464
mcp_client: ClientSession,

tests/dashboards_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@pytest.mark.parametrize("model", models)
13-
@pytest.mark.flaky(max_runs=3)
13+
@pytest.mark.flaky(reruns=2)
1414
async def test_dashboard_panel_queries_tool(
1515
model: str,
1616
mcp_client: ClientSession,
@@ -40,7 +40,7 @@ async def test_dashboard_panel_queries_tool(
4040

4141

4242
@pytest.mark.parametrize("model", models)
43-
@pytest.mark.flaky(max_runs=3)
43+
@pytest.mark.flaky(reruns=2)
4444
async def test_dashboard_update_with_patch_operations(
4545
model: str,
4646
mcp_client: ClientSession,

tests/elasticsearch_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@pytest.mark.parametrize("model", models)
12-
@pytest.mark.flaky(max_runs=3)
12+
@pytest.mark.flaky(reruns=2)
1313
async def test_elasticsearch_query_logs(
1414
model: str,
1515
mcp_client: ClientSession,
@@ -37,7 +37,7 @@ async def test_elasticsearch_query_logs(
3737

3838

3939
@pytest.mark.parametrize("model", models)
40-
@pytest.mark.flaky(max_runs=3)
40+
@pytest.mark.flaky(reruns=2)
4141
async def test_elasticsearch_query_errors(
4242
model: str,
4343
mcp_client: ClientSession,

tests/loki_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@pytest.mark.parametrize("model", models)
12-
@pytest.mark.flaky(max_runs=3)
12+
@pytest.mark.flaky(reruns=2)
1313
async def test_loki_logs_tool(
1414
model: str,
1515
mcp_client: ClientSession,
@@ -37,7 +37,7 @@ async def test_loki_logs_tool(
3737

3838

3939
@pytest.mark.parametrize("model", models)
40-
@pytest.mark.flaky(max_runs=3)
40+
@pytest.mark.flaky(reruns=2)
4141
async def test_loki_container_labels(
4242
model: str,
4343
mcp_client: ClientSession,

tests/navigation_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def _run_deeplink_test_with_expected_args(
6161

6262

6363
@pytest.mark.parametrize("model", models)
64-
@pytest.mark.flaky(max_runs=3)
64+
@pytest.mark.flaky(reruns=2)
6565
async def test_generate_dashboard_deeplink(
6666
model: str,
6767
mcp_client: ClientSession,
@@ -80,7 +80,7 @@ async def test_generate_dashboard_deeplink(
8080

8181

8282
@pytest.mark.parametrize("model", models)
83-
@pytest.mark.flaky(max_runs=3)
83+
@pytest.mark.flaky(reruns=2)
8484
async def test_generate_panel_deeplink(
8585
model: str,
8686
mcp_client: ClientSession,
@@ -103,7 +103,7 @@ async def test_generate_panel_deeplink(
103103

104104

105105
@pytest.mark.parametrize("model", models)
106-
@pytest.mark.flaky(max_runs=3)
106+
@pytest.mark.flaky(reruns=2)
107107
async def test_generate_explore_deeplink(
108108
model: str,
109109
mcp_client: ClientSession,
@@ -122,7 +122,7 @@ async def test_generate_explore_deeplink(
122122

123123

124124
@pytest.mark.parametrize("model", models)
125-
@pytest.mark.flaky(max_runs=3)
125+
@pytest.mark.flaky(reruns=2)
126126
async def test_generate_deeplink_with_time_range(
127127
model: str,
128128
mcp_client: ClientSession,
@@ -145,7 +145,7 @@ async def test_generate_deeplink_with_time_range(
145145

146146

147147
@pytest.mark.parametrize("model", models)
148-
@pytest.mark.flaky(max_runs=3)
148+
@pytest.mark.flaky(reruns=2)
149149
async def test_generate_deeplink_with_query_params(
150150
model: str,
151151
mcp_client: ClientSession,

tests/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ dependencies = []
1515
dev = [
1616
"anyio>=4.9.0",
1717
"deepeval>=1.0.0",
18-
"flaky>=3.8.1",
1918
"litellm>=1.63.12",
2019
"mcp>=1.9.3",
2120
"pytest>=8.3.5",
2221
"python-dotenv>=1.0.0",
2322
]
2423

2524
[tool.pytest.ini_options]
25+
addopts = "-p no:flaky"

tests/rendering_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@pytest.mark.parametrize("model", models)
13-
@pytest.mark.flaky(max_runs=3)
13+
@pytest.mark.flaky(reruns=2)
1414
async def test_get_panel_image(
1515
model: str,
1616
mcp_client: ClientSession,

tests/tempo_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class TestTempoProxiedToolsWithLLM:
200200
"""LLM integration tests for Tempo proxied tools."""
201201

202202
@pytest.mark.parametrize("model", models)
203-
@pytest.mark.flaky(max_runs=3)
203+
@pytest.mark.flaky(reruns=2)
204204
async def test_llm_can_list_trace_attributes(
205205
self, model: str, mcp_client: ClientSession, mcp_transport: str
206206
):

0 commit comments

Comments
 (0)