Skip to content

Commit 8424c7a

Browse files
authored
fix: add retries for flaky integ tests that depend on LLM responses (#351)
1 parent 530f203 commit 8424c7a

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ dev = [
148148
"pytest-asyncio>=0.24.0",
149149
"pytest-cov>=6.0.0",
150150
"pytest-order>=1.3.0",
151+
"pytest-rerunfailures>=15.0",
151152
"ruff>=0.12.0",
152153
"websockets>=14.1",
153154
"wheel>=0.45.1",

tests_integ/memory/integrations/test_session_manager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_agent_with_session_manager(self, test_memory_stm):
115115

116116
assert agent._session_manager == session_manager
117117

118+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
118119
def test_conversation_persistence(self, test_memory_stm):
119120
"""Test that conversations are persisted to memory."""
120121
session_config = AgentCoreMemoryConfig(
@@ -135,6 +136,7 @@ def test_conversation_persistence(self, test_memory_stm):
135136
assert response2 is not None
136137
assert "John" in response2.message["content"][0]["text"]
137138

139+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
138140
def test_session_manager_with_retrieval_config_adds_context(self, test_memory_ltm):
139141
"""Test session manager with custom retrieval configuration."""
140142
actor_id = f"test-actor-{int(time.time())}"
@@ -164,6 +166,7 @@ def test_session_manager_with_retrieval_config_adds_context(self, test_memory_lt
164166
assert "sushi" in str(agent.messages)
165167
assert "<user_context>" in str(agent.messages)
166168

169+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
167170
def test_multiple_namespace_retrieval_config(self, test_memory_ltm):
168171
"""Test session manager with multiple namespace retrieval configurations."""
169172
actor_id = f"test-actor-{int(time.time())}"
@@ -301,6 +304,7 @@ def test_legacy_event_migration(self, test_memory_stm, memory_client):
301304

302305
# region End-to-end agent with batching tests
303306

307+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
304308
def test_agent_conversation_with_context_manager(self, test_memory_stm):
305309
"""Test that Agent messages are flushed when the context manager exits, and session resume loads them."""
306310
session_id = f"test-agent-ctx-{uuid.uuid4().hex[:8]}"
@@ -336,6 +340,7 @@ def test_agent_conversation_with_context_manager(self, test_memory_stm):
336340

337341
sm2.close()
338342

343+
@pytest.mark.flaky(reruns=2, reruns_delay=5)
339344
def test_agent_multi_turn_with_batching(self, test_memory_stm):
340345
"""Test that a multi-turn conversation within a single Agent works with batching."""
341346
session_id = f"test-agent-multi-{uuid.uuid4().hex[:8]}"

0 commit comments

Comments
 (0)