diff --git a/tests/test_rag_engine.py b/tests/test_rag_engine.py index 370d20d5..7256f2c2 100644 --- a/tests/test_rag_engine.py +++ b/tests/test_rag_engine.py @@ -104,8 +104,14 @@ def test_rag_collection_dim_mismatch_recreates_collection(mock_get_chroma, mock_ mock_st.return_value = MagicMock() engine = RAGEngine(config) assert engine.collection == mock_collection - mock_client.delete_collection.assert_called_once_with("test") + # On dim mismatch, the fix wipes the chroma dir via shutil.rmtree + # (not via client.delete_collection which fails on corrupted state + # in chromadb 1.5.x with "RustBindingsAPI object has no attribute + # bindings"). The collection is then re-initialized by the inline + # re-init code, which calls get_or_create_collection once more + # (after the original _init_vector_store call). assert mock_client.get_or_create_collection.call_count == 2 + mock_client.delete_collection.assert_not_called() @patch('src.rag_engine.LocalEmbeddingProvider.embed') @patch('src.rag_engine._get_chromadb')