Skip to content

Commit 39c76f3

Browse files
committed
set up try except block
1 parent 0e4f086 commit 39c76f3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libs/labelbox/tests/integration/test_filtering.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ def project_to_test_where(client, rand_gen):
2121

2222
while (num_retries > 0):
2323
projects = client.get_projects()
24-
if projects is None or len(list(projects)) != 3:
24+
try:
25+
if len(list(projects)) >= 3:
26+
break
27+
except TypeError:
2528
num_retries -= 1
2629
time.sleep(5)
27-
else:
28-
break
2930

31+
if num_retries == 0:
32+
raise TimeoutError("Hit max number of retries getting projects")
33+
3034
yield p_a, p_b, p_c
3135

3236
p_a.delete()

0 commit comments

Comments
 (0)