mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-02 10:49:30 +00:00
avoid importing the weaviate client directly (#4945)
This commit is contained in:
parent
1f3debfd74
commit
58acef77c4
@ -8,7 +8,6 @@ import numpy as np
|
||||
from haystack.document_stores.weaviate import WeaviateDocumentStore
|
||||
from haystack.schema import Document
|
||||
from haystack.testing import DocumentStoreBaseTestAbstract
|
||||
from haystack.document_stores import weaviate
|
||||
|
||||
embedding_dim = 768
|
||||
|
||||
@ -64,17 +63,10 @@ class TestWeaviateDocumentStore(DocumentStoreBaseTestAbstract):
|
||||
"""
|
||||
This fixture provides an instance of the WeaviateDocumentStore equipped with a mocked Weaviate client.
|
||||
"""
|
||||
|
||||
class DSMock(WeaviateDocumentStore):
|
||||
pass
|
||||
|
||||
mocked_client = mock.MagicMock()
|
||||
mocked_client.Client().is_ready.return_value = True
|
||||
mocked_client.Client().schema.contains.return_value = False
|
||||
weaviate.client = mocked_client
|
||||
mocked_ds = DSMock()
|
||||
|
||||
return mocked_ds
|
||||
with mock.patch("haystack.document_stores.weaviate.client") as mocked_client:
|
||||
mocked_client.Client().is_ready.return_value = True
|
||||
mocked_client.Client().schema.contains.return_value = False
|
||||
yield WeaviateDocumentStore()
|
||||
|
||||
@pytest.mark.skip(reason="Weaviate does not support labels")
|
||||
@pytest.mark.integration
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user