mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-15 09:33:34 +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.document_stores.weaviate import WeaviateDocumentStore
|
||||||
from haystack.schema import Document
|
from haystack.schema import Document
|
||||||
from haystack.testing import DocumentStoreBaseTestAbstract
|
from haystack.testing import DocumentStoreBaseTestAbstract
|
||||||
from haystack.document_stores import weaviate
|
|
||||||
|
|
||||||
embedding_dim = 768
|
embedding_dim = 768
|
||||||
|
|
||||||
@ -64,17 +63,10 @@ class TestWeaviateDocumentStore(DocumentStoreBaseTestAbstract):
|
|||||||
"""
|
"""
|
||||||
This fixture provides an instance of the WeaviateDocumentStore equipped with a mocked Weaviate client.
|
This fixture provides an instance of the WeaviateDocumentStore equipped with a mocked Weaviate client.
|
||||||
"""
|
"""
|
||||||
|
with mock.patch("haystack.document_stores.weaviate.client") as mocked_client:
|
||||||
class DSMock(WeaviateDocumentStore):
|
mocked_client.Client().is_ready.return_value = True
|
||||||
pass
|
mocked_client.Client().schema.contains.return_value = False
|
||||||
|
yield WeaviateDocumentStore()
|
||||||
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
|
|
||||||
|
|
||||||
@pytest.mark.skip(reason="Weaviate does not support labels")
|
@pytest.mark.skip(reason="Weaviate does not support labels")
|
||||||
@pytest.mark.integration
|
@pytest.mark.integration
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user