Skip to content

Commit c7b0623

Browse files
Merge pull request #732 from Labelbox/kkim/polish-tests
[AL-0] Polishing some sdk tests
2 parents 70ee77d + 38e1d0c commit c7b0623

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

tests/integration/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from labelbox.orm import query
1616
from labelbox.pagination import PaginatedCollection
1717
from labelbox.schema.annotation_import import LabelImport
18+
from labelbox.schema.enums import AnnotationImportState
1819
from labelbox.schema.invite import Invite
1920
from labelbox.schema.queue_mode import QueueMode
2021
from labelbox.schema.user import User
@@ -334,6 +335,7 @@ def create_label():
334335
upload_task = LabelImport.create_from_objects(
335336
client, project.uid, f'label-import-{uuid.uuid4()}', predictions)
336337
upload_task.wait_until_done(sleep_time_seconds=5)
338+
assert upload_task.state == AnnotationImportState.FINISHED
337339

338340
project.create_label = create_label
339341
project.create_label()

tests/integration/test_data_rows.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ def test_data_row_bulk_creation(dataset, rand_gen, image_url):
150150
@pytest.mark.slow
151151
def test_data_row_large_bulk_creation(dataset, image_url):
152152
# Do a longer task and expect it not to be complete immediately
153-
n_local = 2000
154-
n_urls = 250
153+
n_urls = 1000
154+
n_local = 250
155155
with NamedTemporaryFile() as fp:
156156
fp.write("Test data".encode())
157157
fp.flush()
158158
task = dataset.create_data_rows([{
159159
DataRow.row_data: image_url
160-
}] * n_local + [fp.name] * n_urls)
160+
}] * n_urls + [fp.name] * n_local)
161161
task.wait_till_done()
162162
assert task.status == "COMPLETE"
163163
assert len(list(dataset.data_rows())) == n_local + n_urls

tests/integration/test_delegated_access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from labelbox import Client
77

88

9-
@pytest.mark.skipif(os.environ.get("DA_GCP_LABELBOX_API_KEY") is None,
9+
@pytest.mark.skipif(not os.environ.get('DA_GCP_LABELBOX_API_KEY'),
1010
reason="DA_GCP_LABELBOX_API_KEY not found")
1111
def test_default_integration():
1212
"""
@@ -28,7 +28,7 @@ def test_default_integration():
2828
ds.delete()
2929

3030

31-
@pytest.mark.skipif(os.environ.get("DA_GCP_LABELBOX_API_KEY") is None,
31+
@pytest.mark.skipif(not os.environ.get("DA_GCP_LABELBOX_API_KEY"),
3232
reason="DA_GCP_LABELBOX_API_KEY not found")
3333
def test_non_default_integration():
3434
"""

tests/integration/test_label.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_label_export(configured_project_with_label):
4646
# TODO: Skipping this test in staging due to label not updating
4747
@pytest.mark.skipif(condition=os.environ['LABELBOX_TEST_ENVIRON'] == "onprem" or
4848
os.environ['LABELBOX_TEST_ENVIRON'] == "staging" or
49+
os.environ['LABELBOX_TEST_ENVIRON'] == "local" or
4950
os.environ['LABELBOX_TEST_ENVIRON'] == "custom",
5051
reason="does not work for onprem")
5152
def test_label_update(configured_project_with_label):

0 commit comments

Comments
 (0)