Skip to content

Commit c45d294

Browse files
authored
test: pinecone - use uuid for namespace names (#1984)
1 parent be8d028 commit c45d294

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

integrations/pinecone/src/haystack_integrations/document_stores/pinecone/filters.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,7 @@ def _in(field: str, value: Any) -> Dict[str, Any]:
161161
supported_types = (int, float, str)
162162
for v in value:
163163
if not isinstance(v, supported_types):
164-
msg = (
165-
f"Unsupported type for 'in' comparison: {type(v)}. "
166-
f"Types supported by Pinecone are: {supported_types}"
167-
)
164+
msg = f"Unsupported type for 'in' comparison: {type(v)}. Types supported by Pinecone are: {supported_types}"
168165
raise FilterError(msg)
169166

170167
return {field: {"$in": value}}

integrations/pinecone/tests/conftest.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import asyncio
22
import time
3+
import uuid
34

45
import pytest
56
import pytest_asyncio
67
from haystack.document_stores.types import DuplicatePolicy
7-
8-
try:
9-
# pinecone-client < 5.0.0
10-
from pinecone.core.client.exceptions import NotFoundException
11-
except ModuleNotFoundError:
12-
# pinecone-client >= 5.0.0
13-
from pinecone.exceptions import NotFoundException
8+
from pinecone.exceptions import NotFoundException
149

1510
from haystack_integrations.document_stores.pinecone import PineconeDocumentStore
1611

@@ -31,7 +26,7 @@ def document_store(request):
3126
"""
3227
index = "default"
3328
# Use a different namespace for each test so we can run them in parallel
34-
namespace = f"{request.node.name}-{int(time.time())}"
29+
namespace = f"{request.node.name}-{uuid.uuid4()}"
3530
dimension = 768
3631

3732
store = PineconeDocumentStore(
@@ -72,7 +67,7 @@ async def document_store_async(request):
7267
"""
7368
index = "default"
7469
# Use a different namespace for each test so we can run them in parallel
75-
namespace = f"{request.node.name}-{int(time.time())}"
70+
namespace = f"{request.node.name}-{uuid.uuid4()}"
7671
dimension = 768
7772

7873
store = PineconeDocumentStore(

0 commit comments

Comments
 (0)