Skip to content

Commit e008d22

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
fixed project copy
1 parent ad08cd9 commit e008d22

File tree

4 files changed

+53
-11
lines changed

4 files changed

+53
-11
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 = -n32 --dist=loadscope
5+
;addopts = -n32 --dist=loadscope

src/superannotate/lib/core/usecases.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ def execute(self):
363363
] = new_project_annotation_classes.insert(annotation_class_copy)
364364

365365
if self._include_contributors:
366+
self._project = self._projects.get_one(
367+
uuid=self._project.uuid, team_id=self._project.team_id
368+
)
366369
for user in self._project.users:
367370
self._backend_service.share_project(
368371
project.uuid,

tests/integration/test_create_from_full_info.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,15 @@ def test_create_from_full_info(self):
8989
self.assertEqual(
9090
len(new_project_metadata["workflows"]), len(project_metadata["workflows"])
9191
)
92+
93+
def test_clone_contributors(self):
94+
team_users = sa.search_team_contributors()
95+
sa.share_project(self.PROJECT_NAME_1, team_users[0], "QA")
96+
first_project_contributors = sa.get_project_metadata(
97+
self.PROJECT_NAME_1, include_contributors=True
98+
)["contributors"]
99+
sa.clone_project(self.PROJECT_NAME_2, self.PROJECT_NAME_1, copy_contributors=True)
100+
second_project_contributors = sa.get_project_metadata(
101+
self.PROJECT_NAME_2, include_contributors=True
102+
)["contributors"]
103+
self.assertEqual(first_project_contributors[0]["user_id"], second_project_contributors[0]["user_id"])

tests/profiling/profiling.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,45 @@
33
import cProfile
44
import pstats
55
import io
6-
sa.delete_images("dev")
6+
#
7+
# pr = cProfile.Profile()
8+
# pr.enable()
9+
# sa.delete_images("dev")
10+
# sa.upload_images_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
11+
# sa.upload_annotations_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
12+
#
13+
# pr.disable()
14+
# s = io.StringIO()
15+
#
16+
# ps = pstats.Stats(pr, stream=s)
17+
# ps.print_stats()
18+
# print(s.getvalue())
719

820

9-
sa.upload_images_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
10-
pr = cProfile.Profile()
11-
pr.enable()
21+
# import time
22+
# results = []
23+
#
24+
# for i in range(10):
25+
# start = time.time()
26+
# sa.delete_images("dev", None)
27+
# sa.upload_images_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
28+
# sa.upload_annotations_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
29+
# end = time.time()
30+
# results.append(end-start)
31+
#
32+
# print(results)
33+
# print(sum(results)/10)
1234

13-
sa.upload_annotations_from_folder_to_project("dev", "/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/data_set/sample_project_vector")
35+
import time
36+
results = []
37+
projects = "11", "22", "33", "44", "55", "66", "77", "88", "99"
1438

15-
pr.disable()
16-
s = io.StringIO()
39+
for project in projects:
40+
start = time.time()
41+
sa.search_annotation_classes(project)
42+
end = time.time()
43+
results.append(end-start)
44+
45+
print(results)
46+
print(sum(results)/9)
1747

18-
ps = pstats.Stats(pr, stream=s)
19-
ps.print_stats()
20-
print(s.getvalue())

0 commit comments

Comments
 (0)