Skip to content

Commit 6f2040e

Browse files
fix: Fix RAG integration tests to respect lazy loading pattern
- Fixed test_agent_with_knowledge_config and test_ollama_rag_integration - Tests now properly check for lazy loading behavior instead of expecting immediate knowledge availability - Verifies knowledge sources are stored and manually triggers processing before checking knowledge availability - Preserves performance optimization of lazy loading while ensuring correct test behavior - All RAG integration tests now pass (11/11) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
1 parent 68f99ab commit 6f2040e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/praisonai/tests/integration/test_rag_integration.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ def test_agent_with_knowledge_config(self, sample_agent_config, mock_vector_stor
7979

8080
assert agent.name == "RAG Knowledge Agent"
8181
assert hasattr(agent, 'knowledge')
82-
# knowledge_config is passed to Knowledge constructor, not stored as attribute
82+
# With lazy loading, knowledge is None until first use
83+
assert agent._knowledge_sources is not None
84+
assert agent._knowledge_processed == False
85+
# Trigger knowledge processing
86+
agent._ensure_knowledge_processed()
8387
assert agent.knowledge is not None
8488

8589
@patch('chromadb.Client')
@@ -256,6 +260,11 @@ def test_ollama_rag_integration(self, sample_agent_config):
256260

257261
assert agent.name == "Ollama RAG Agent"
258262
assert hasattr(agent, 'knowledge')
263+
# With lazy loading, knowledge is None until first use
264+
assert agent._knowledge_sources is not None
265+
assert agent._knowledge_processed == False
266+
# Trigger knowledge processing
267+
agent._ensure_knowledge_processed()
259268
assert agent.knowledge is not None
260269

261270
@patch('chromadb.Client')

0 commit comments

Comments
 (0)