Skip to content

Commit 625af3c

Browse files
committed
Disable preannotation tests
1 parent 1b41272 commit 625af3c

File tree

7 files changed

+83
-25
lines changed

7 files changed

+83
-25
lines changed

superannotate/db/images.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -795,20 +795,28 @@ def get_image_annotations(project, image_name, project_type=None):
795795
common.get_annotation_json_name(image_name, project_type)
796796
}
797797
if project_type == "Pixel":
798-
response = requests.get(
799-
url=main_annotations["annotation_bluemap_path"]["url"],
800-
headers=main_annotations["annotation_bluemap_path"]["headers"]
801-
)
802-
if not response.ok:
803-
raise SABaseException(
804-
response.status_code,
805-
"Couldn't load annotations" + response.text
798+
if main_annotations["annotation_bluemap_path"]["exist"]:
799+
response = requests.get(
800+
url=main_annotations["annotation_bluemap_path"]["url"],
801+
headers=main_annotations["annotation_bluemap_path"]["headers"]
802+
)
803+
if not response.ok:
804+
raise SABaseException(
805+
response.status_code,
806+
"Couldn't load annotations" + response.text
807+
)
808+
mask = io.BytesIO(response.content)
809+
result["annotation_mask"] = mask
810+
result["annotation_mask_filename"] = common.get_annotation_png_name(
811+
image_name
812+
)
813+
else:
814+
result.update(
815+
{
816+
"annotation_mask": None,
817+
"annotation_mask_filename": None
818+
}
806819
)
807-
mask = io.BytesIO(response.content)
808-
result["annotation_mask"] = mask
809-
result["annotation_mask_filename"] = common.get_annotation_png_name(
810-
image_name
811-
)
812820
return result
813821

814822

tests/test_basic_images.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ def test_basic_images(project_type, name, description, from_folder, tmpdir):
4040

4141
image_name = images[0]
4242
sa.download_image(project, image_name, tmpdir, True)
43-
assert sa.get_image_preannotations(project, image_name
44-
)["preannotation_json_filename"] is None
43+
# assert sa.get_image_preannotations(project, image_name
44+
# )["preannotation_json_filename"] is None
4545
assert len(
4646
sa.get_image_annotations(project,
4747
image_name)["annotation_json"]["instances"]
4848
) == 0
4949
sa.download_image_annotations(project, image_name, tmpdir)
5050
assert len(list(Path(tmpdir).glob("*"))) == 2
51-
sa.download_image_preannotations(project, image_name, tmpdir)
52-
assert len(list(Path(tmpdir).glob("*"))) == 2
51+
# sa.download_image_preannotations(project, image_name, tmpdir)
52+
# assert len(list(Path(tmpdir).glob("*"))) == 2
5353

5454
assert (Path(tmpdir) / image_name).is_file()
5555

tests/test_missing_annotation_upload.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import os
12
from pathlib import Path
23

4+
import pytest
35
import superannotate as sa
46

57

@@ -34,6 +36,10 @@ def test_missing_annotation_upload(tmpdir):
3436
assert "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json" in missing_images
3537

3638

39+
@pytest.mark.skipif(
40+
"SA_TEST_PREANNOTATION" not in os.environ,
41+
reason="Requires env variable to be set"
42+
)
3743
def test_missing_preannotation_upload(tmpdir):
3844
name = "Example Project test vector missing preannotation upload"
3945
project_type = "Vector"
@@ -62,4 +68,4 @@ def test_missing_preannotation_upload(tmpdir):
6268
assert "tests/sample_project_vector_for_checks/example_image_1.jpg___objects.json" in uploaded
6369
assert "tests/sample_project_vector_for_checks/example_image_5.jpg___objects.json" in uploaded
6470
assert "tests/sample_project_vector_for_checks/example_image_2.jpg___objects.json" in couldnt_upload
65-
assert "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json" in couldnt_upload
71+
assert "tests/sample_project_vector_for_checks/example_image_4.jpg___objects.json" in couldnt_upload

tests/test_multiple_annotations_upload_pixel_s3.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
import os
12
from pathlib import Path
23
from urllib.parse import urlparse
34

45
import pytest
5-
66
import superannotate as sa
7-
sa.init(Path.home() / ".superannotate" / "config.json")
87

98
TEST_PROJECT_PIXEL = "sample_project_pixel"
109
TEST_PROJECT_VECTOR = "sample_project_vector"
@@ -43,6 +42,10 @@ def test_upload_from_s3(tmpdir):
4342
sa.delete_project(project)
4443

4544

45+
@pytest.mark.skipif(
46+
"SA_TEST_PREANNOTATION" not in os.environ,
47+
reason="Requires env variable to be set"
48+
)
4649
def test_pixel_preannotation_upload_from_s3(tmpdir):
4750
projects_found = sa.search_projects(TEST_PROJECT2, return_metadata=True)
4851
for pr in projects_found:
@@ -72,6 +75,10 @@ def test_pixel_preannotation_upload_from_s3(tmpdir):
7275
sa.delete_project(project)
7376

7477

78+
@pytest.mark.skipif(
79+
"SA_TEST_PREANNOTATION" not in os.environ,
80+
reason="Requires env variable to be set"
81+
)
7582
def test_vector_preannotation_upload_from_s3(tmpdir):
7683
projects_found = sa.search_projects(TEST_PROJECT3, return_metadata=True)
7784
for pr in projects_found:

tests/test_preannotation_upload.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import os
12
from pathlib import Path
2-
import subprocess
3-
import time
43

54
import pytest
6-
75
import superannotate as sa
86

97

8+
@pytest.mark.skipif(
9+
"SA_TEST_PREANNOTATION" not in os.environ,
10+
reason="Requires env variable to be set"
11+
)
1012
@pytest.mark.parametrize(
1113
"project_type,name,description,from_folder", [
1214
(

tests/test_preannotation_upload_cli.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
from pathlib import Path
1+
import os
22
import subprocess
33
import time
4+
from pathlib import Path
45

56
import pytest
6-
77
import superannotate as sa
88

99

10+
@pytest.mark.skipif(
11+
"SA_TEST_PREANNOTATION" not in os.environ,
12+
reason="Requires env variable to be set"
13+
)
1014
@pytest.mark.parametrize(
1115
"project_type,name,description,from_folder", [
1216
(
@@ -83,6 +87,10 @@ def test_annotation_folder_upload_download_cli_vector_COCO(tmpdir):
8387
assert count_in == count_out
8488

8589

90+
@pytest.mark.skipif(
91+
"SA_TEST_PREANNOTATION" not in os.environ,
92+
reason="Requires env variable to be set"
93+
)
8694
def test_preannotation_folder_upload_download_cli_vector_COCO(tmpdir):
8795
project_type = "Vector"
8896
name = "Example Project test vector2 preannotation cli upload coco vector"
@@ -116,6 +124,10 @@ def test_preannotation_folder_upload_download_cli_vector_COCO(tmpdir):
116124
assert count_in == count_out
117125

118126

127+
@pytest.mark.skipif(
128+
"SA_TEST_PREANNOTATION" not in os.environ,
129+
reason="Requires env variable to be set"
130+
)
119131
def test_preannotation_folder_upload_download_cli_vector_object_COCO(tmpdir):
120132
project_type = "Vector"
121133
name = "Example Project test vector1 preannotation cli upload coco object vector"
@@ -149,6 +161,10 @@ def test_preannotation_folder_upload_download_cli_vector_object_COCO(tmpdir):
149161
assert count_in == count_out
150162

151163

164+
@pytest.mark.skipif(
165+
"SA_TEST_PREANNOTATION" not in os.environ,
166+
reason="Requires env variable to be set"
167+
)
152168
def test_preannotation_folder_upload_download_cli_pixel_object_COCO(tmpdir):
153169
project_type = "Pixel"
154170
name = "Example Project test pixel1 preannotation cli upload coco object pixel"

tests/test_recursive_folder.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import json
22
from pathlib import Path
33
import time
4+
import os
5+
6+
import pytest
47

58
import superannotate as sa
69

@@ -84,6 +87,10 @@ def test_recursive_annotations_folder(tmpdir):
8487
assert len(list(tmpdir.glob("*.json"))) == 2
8588

8689

90+
@pytest.mark.skipif(
91+
"SA_TEST_PREANNOTATION" not in os.environ,
92+
reason="Requires env variable to be set"
93+
)
8794
def test_recursive_preannotations_folder(tmpdir):
8895
tmpdir = Path(tmpdir)
8996
projects_found = sa.search_projects(
@@ -117,6 +124,10 @@ def test_recursive_preannotations_folder(tmpdir):
117124
assert len(list(tmpdir.glob("*.json"))) == 2
118125

119126

127+
@pytest.mark.skipif(
128+
"SA_TEST_PREANNOTATION" not in os.environ,
129+
reason="Requires env variable to be set"
130+
)
120131
def test_nonrecursive_preannotations_folder(tmpdir):
121132
tmpdir = Path(tmpdir)
122133
projects_found = sa.search_projects(
@@ -239,6 +250,10 @@ def test_annotations_nonrecursive_s3_folder(tmpdir):
239250
assert non_empty_annotations == 1
240251

241252

253+
@pytest.mark.skipif(
254+
"SA_TEST_PREANNOTATION" not in os.environ,
255+
reason="Requires env variable to be set"
256+
)
242257
def test_preannotations_recursive_s3_folder(tmpdir):
243258
tmpdir = Path(tmpdir)
244259
projects_found = sa.search_projects(
@@ -277,6 +292,10 @@ def test_preannotations_recursive_s3_folder(tmpdir):
277292
assert len(list(tmpdir.glob("*.json"))) == 2
278293

279294

295+
@pytest.mark.skipif(
296+
"SA_TEST_PREANNOTATION" not in os.environ,
297+
reason="Requires env variable to be set"
298+
)
280299
def test_preannotations_nonrecursive_s3_folder(tmpdir):
281300
tmpdir = Path(tmpdir)
282301
projects_found = sa.search_projects(

0 commit comments

Comments
 (0)