Skip to content

Commit

Permalink
Use helpers in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Oct 19, 2024
1 parent 4c6686f commit 327c211
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tests/integration/control/pod/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
import random
import string
import time
from pinecone import Pinecone, PodSpec
from ...helpers import generate_index_name, generate_collection_name, get_environment_var
Expand Down Expand Up @@ -69,17 +68,13 @@ def index_exists(index_name, client):
return index_name in client.list_indexes().names()


def random_string():
return "".join(random.choice(string.ascii_lowercase) for i in range(10))


@pytest.fixture(scope="session")
def reusable_collection():
pc = Pinecone(
api_key=get_environment_var("PINECONE_API_KEY"),
additional_headers={"sdk-test-suite": "pinecone-python-client"},
)
index_name = "temp-index-" + random_string()
index_name = generate_index_name("temp-index")
dimension = int(get_environment_var("DIMENSION"))
print(f"Creating index {index_name} to prepare a collection...")
pc.create_index(
Expand All @@ -99,7 +94,7 @@ def reusable_collection():
index = pc.Index(index_name)
index.upsert(vectors=vectors)

collection_name = generate_collection_name("reused-coll-" + random_string())
collection_name = generate_collection_name("reused-coll")
pc.create_collection(name=collection_name, source=index_name)

time_waited = 0
Expand Down

0 comments on commit 327c211

Please sign in to comment.