Skip to content

Improved test where #1756

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

Closed
wants to merge 4 commits into from
Closed
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
29 changes: 24 additions & 5 deletions libs/labelbox/tests/integration/test_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@

from labelbox import Project
from labelbox.exceptions import InvalidQueryError
from labelbox.schema.queue_mode import QueueMode
from labelbox import MediaType
import time
import logging


@pytest.fixture
def project_to_test_where(client, rand_gen):
num_retries = 5

p_a_name = f"a-{rand_gen(str)}"
p_b_name = f"b-{rand_gen(str)}"
p_c_name = f"c-{rand_gen(str)}"

p_a = client.create_project(name=p_a_name, media_type=MediaType.Image)
p_b = client.create_project(name=p_b_name, media_type=MediaType.Image)
p_c = client.create_project(name=p_c_name, media_type=MediaType.Image)

while (num_retries > 0):
projects = client.get_projects()
try:
logging.log(level=2, msg=f"{len(list(projects))}")
if len(list(projects)) >= 3:
break
else:
raise TypeError()
except:
num_retries -= 1
time.sleep(5)

p_a = client.create_project(name=p_a_name, queue_mode=QueueMode.Batch)
p_b = client.create_project(name=p_b_name, queue_mode=QueueMode.Batch)
p_c = client.create_project(name=p_c_name, queue_mode=QueueMode.Batch)

if num_retries == 0:
raise TimeoutError("Hit max number of retries getting projects")

yield p_a, p_b, p_c

p_a.delete()
Expand Down
Loading