Skip to content

Set up test embeddings to be reusable #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions libs/labelbox/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from labelbox.schema.quality_mode import QualityMode
from labelbox.schema.queue_mode import QueueMode
from labelbox.schema.user import User
from labelbox.exceptions import LabelboxError
from contextlib import suppress
from labelbox import Client

IMG_URL = "https://picsum.photos/200/300.jpg"
Expand Down Expand Up @@ -1063,12 +1065,20 @@ def configured_project_with_complex_ontology(client, initial_dataset, rand_gen,
project.delete()


@pytest.fixture
def embedding(client: Client):
@pytest.fixture(scope="session")
def embedding(client: Client, environ):

uuid_str = uuid.uuid4().hex
embedding = client.create_embedding(f"sdk-int-{uuid_str}", 8)
yield embedding
embedding.delete()
# Remove all embeddings on staging
if environ == Environ.STAGING:
embeddings = client.get_embeddings()
for embedding in embeddings:
with suppress(LabelboxError):
embedding.delete()
else:
embedding.delete()


@pytest.fixture
Expand Down
Loading