Skip to content

Commit 7b4e828

Browse files
committed
merge friday
2 parents 75fa3b9 + 8f61bd8 commit 7b4e828

File tree

12 files changed

+25
-14
lines changed

12 files changed

+25
-14
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
minversion = 3.0
33
log_cli=true
44
python_files = test_*.py
5-
;addopts = -n auto --dist=loadscope
5+
;addopts = -n auto --dist=loads cope

src/superannotate/lib/app/analytics/aggregators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import copy
22
import json
3-
from dataclasses import dataclass
43
from pathlib import Path
54
from typing import List
65
from typing import Optional
76
from typing import Union
87

98
import lib.core as constances
109
import pandas as pd
10+
from dataclasses import dataclass
1111
from lib.app.exceptions import AppException
1212
from lib.core import ATTACHED_VIDEO_ANNOTATION_POSTFIX
1313
from lib.core import PIXEL_ANNOTATION_POSTFIX

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,6 +2334,8 @@ def add_annotation_bbox_to_image(
23342334
response = controller.get_image_annotations(
23352335
project_name=project_name, folder_name=folder_name, image_name=image_name
23362336
)
2337+
if response.errors:
2338+
raise AppException(response.errors)
23372339
annotations = response.data["annotation_json"]
23382340
annotations = add_annotation_bbox_to_json(
23392341
annotations,
@@ -2380,6 +2382,8 @@ def add_annotation_point_to_image(
23802382
response = controller.get_image_annotations(
23812383
project_name=project_name, folder_name=folder_name, image_name=image_name
23822384
)
2385+
if response.errors:
2386+
raise AppException(response.errors)
23832387
annotations = response.data["annotation_json"]
23842388
annotations = add_annotation_point_to_json(
23852389
annotations,
@@ -2423,6 +2427,8 @@ def add_annotation_comment_to_image(
24232427
response = controller.get_image_annotations(
24242428
project_name=project_name, folder_name=folder_name, image_name=image_name
24252429
)
2430+
if response.errors:
2431+
raise AppException(response.errors)
24262432
annotations = response.data["annotation_json"]
24272433
annotations = add_annotation_comment_to_json(
24282434
annotations,

src/superannotate/lib/core/usecases/images.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from lib.core.repositories import BaseManageableRepository
4141
from lib.core.repositories import BaseReadOnlyRepository
4242
from lib.core.response import Response
43+
from lib.core.reporter import Progress
4344
from lib.core.serviceproviders import SuerannotateServiceProvider
4445
from lib.core.usecases.base import BaseInteractiveUseCase
4546
from lib.core.usecases.base import BaseReportableUseCae
@@ -3208,7 +3209,9 @@ def execute(self) -> Response:
32083209
image_quality_in_editor=self._image_quality_in_editor,
32093210
)
32103211
if not frames_generator_use_case.is_valid():
3211-
self._response.errors = frames_generator_use_case.response.errors
3212+
self._response.errors = (
3213+
frames_generator_use_case.response.errors
3214+
)
32123215
return self._response
32133216

32143217
frames_generator = frames_generator_use_case.execute()

tests/integration/aggregations/test_video_annotation_to_df.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from unittest import TestCase
88

99
import src.superannotate as sa
10+
from src.superannotate.logger import get_default_logger
1011

1112

1213
class TestAggregateVideoAnnotation(TestCase):
@@ -41,7 +42,7 @@ def test_nested_folder_data_filling(self):
4142
def test_empty_folder_log(self):
4243
with tempfile.TemporaryDirectory() as temp_dir:
4344
copy_tree(f"{self.folder_path}/classes", f"{temp_dir}/classes")
44-
logger = logging.getLogger('root')
45+
logger = get_default_logger()
4546
with mock.patch.object(logger, 'warning') as mock_log:
4647
_ = sa.aggregate_annotations_as_df(temp_dir, self.PROJECT_TYPE)
4748
mock_log.assert_called_with(f"Could not find annotations in {temp_dir}.")

tests/integration/test_assign_images.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import pytest
23
from os.path import dirname
34

45
import src.superannotate as sa
@@ -55,6 +56,7 @@ def test_assign_images_folder(self):
5556
self.assertIsNotNone(im1_metadata["qa_name"])
5657
self.assertIsNotNone(im2_metadata["qa_name"])
5758

59+
@pytest.mark.flaky(reruns=2)
5860
def test_un_assign_images(self):
5961

6062
email = sa.get_team_metadata()["users"][0]["email"]

tests/integration/test_attach_image_urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import pytest
23
from os.path import dirname
34

45
import src.superannotate as sa
@@ -14,6 +15,7 @@ class TestImageUrls(BaseTestCase):
1415
PROJECT_DESCRIPTION = "desc"
1516
PROJECT_TYPE = "Vector"
1617

18+
@pytest.mark.flaky(reruns=2)
1719
def test_attach_image_urls(self):
1820
uploaded, could_not_upload, existing_images = sa.attach_image_urls_to_project(
1921
self.PROJECT_NAME,

tests/integration/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def test_vector_pre_annotation_folder_upload_download_cli(self):
169169
)
170170
# tod add test
171171

172-
# @pytest.mark.skipif(CLI_VERSION and CLI_VERSION != sa.__version__,
173-
# reason=f"Updated package version from {CLI_VERSION} to {sa.__version__}")
172+
@pytest.mark.skipif(CLI_VERSION and CLI_VERSION != sa.__version__,
173+
reason=f"Updated package version from {CLI_VERSION} to {sa.__version__}")
174174
def test_vector_annotation_folder_upload_download_cli(self):
175175
self._create_project()
176176
sa.create_annotation_classes_from_classes_json(

tests/integration/test_depricated_functions_document.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from os.path import dirname
3+
import pytest
34
from unittest import TestCase
45

56
import src.superannotate as sa
@@ -61,6 +62,7 @@ def annotation_path(self):
6162
def image_path(self):
6263
return f'{self.folder_path}/example_image_1.jpg'
6364

65+
@pytest.mark.flaky(reruns=2)
6466
def test_deprecated_functions(self):
6567
_, _, _ = sa.attach_document_urls_to_project(
6668
self.PROJECT_NAME,

tests/integration/test_recursive_folder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def test_annotations_recursive_s3_folder(self):
125125

126126
self.assertEqual(len(list(Path(tmp_dir).glob(self.JSON_POSTFIX))), 2)
127127

128+
@pytest.mark.flaky(reruns=2)
128129
def test_annotations_non_recursive_s3_folder(self):
129130
sa.upload_images_from_folder_to_project(
130131
self.PROJECT_NAME,

0 commit comments

Comments
 (0)