Skip to content

Commit f5d1179

Browse files
fix: pytest retry for flaky test (#25)
* fix: pytest retry for flaky test * chore: minor updates (delay and retry on AssertError only) --------- Co-authored-by: gRedHeadphone <[email protected]>
1 parent 7e03bcb commit f5d1179

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ test = [
4646
"isort==5.13.2",
4747
"mypy==1.16.0",
4848
"pytest==8.3.3",
49+
"pytest-retry==1.7.0",
4950
"pytest-xdist==3.6.1",
5051
"pytest-cov==5.0.0",
5152
"pytest-asyncio==0.24.0",

tests/test_graph_retriever.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def retrievers_dynamic():
203203
graph_store.clean_up()
204204

205205

206+
@pytest.mark.flaky(retries=3, only_on=[AssertionError], delay=1)
206207
def test_graph_retriever2_static(retrievers_static):
207208
"""Test the graph retriever."""
208209
for retriever in retrievers_static:
@@ -213,6 +214,7 @@ def test_graph_retriever2_static(retrievers_static):
213214
assert "Elias Thorne" in str(res)
214215

215216

217+
@pytest.mark.flaky(retries=3, only_on=[AssertionError], delay=1)
216218
def test_graph_retriever2_dynamic(retrievers_dynamic):
217219
"""Test the graph retriever."""
218220
retriever = retrievers_dynamic[0] # only NL2GQL fails

0 commit comments

Comments
 (0)