testit-python-commons 3.3.0__tar.gz → 3.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/PKG-INFO +2 -2
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/setup.py +2 -2
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/client/api_client.py +22 -24
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/client/converter.py +40 -13
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
- testit_python_commons-3.3.1/src/testit_python_commons.egg-info/requires.txt +2 -0
- testit_python_commons-3.3.0/src/testit_python_commons.egg-info/requires.txt +0 -2
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/README.md +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/setup.cfg +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/__init__.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/app_properties.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/client/__init__.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/client/client_configuration.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/decorators.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/dynamic_methods.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/__init__.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/adapter_mode.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/link.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/link_type.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/outcome_type.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/step_result.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/test_result.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/__init__.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/adapter_manager.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/logger.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/plugin_manager.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/retry.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/step_manager.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/step_result_storage.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/services/utils.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/step.py +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
- {testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: Python commons for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
Requires-Dist: pluggy
|
|
19
|
-
Requires-Dist: testit-api-client==
|
|
19
|
+
Requires-Dist: testit-api-client==5.0.0
|
|
20
20
|
|
|
21
21
|
# How to enable debug logging?
|
|
22
22
|
1. Add in **connection_config.ini** file from the root directory of the project:
|
|
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='testit-python-commons',
|
|
5
|
-
version='3.3.
|
|
5
|
+
version='3.3.1',
|
|
6
6
|
description='Python commons for Test IT',
|
|
7
7
|
long_description=open('README.md', "r").read(),
|
|
8
8
|
long_description_content_type="text/markdown",
|
|
@@ -23,5 +23,5 @@ setup(
|
|
|
23
23
|
py_modules=['testit', 'testit_python_commons'],
|
|
24
24
|
packages=find_packages(where='src'),
|
|
25
25
|
package_dir={'': 'src'},
|
|
26
|
-
install_requires=['pluggy', 'testit-api-client==
|
|
26
|
+
install_requires=['pluggy', 'testit-api-client==5.0.0']
|
|
27
27
|
)
|
|
@@ -4,11 +4,12 @@ import typing
|
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
|
|
6
6
|
from testit_api_client import ApiClient, Configuration
|
|
7
|
-
from testit_api_client.
|
|
7
|
+
from testit_api_client.api import AttachmentsApi, AutoTestsApi, TestRunsApi, TestResultsApi
|
|
8
8
|
from testit_api_client.models import (
|
|
9
9
|
AttachmentPutModel,
|
|
10
10
|
TestResultModel,
|
|
11
|
-
WorkItemIdModel
|
|
11
|
+
WorkItemIdModel,
|
|
12
|
+
WorkItemIdentifierModel
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
from testit_python_commons.client.client_configuration import ClientConfiguration
|
|
@@ -82,12 +83,12 @@ class ApiClientWorker:
|
|
|
82
83
|
self.__config.get_project_id(),
|
|
83
84
|
test_result.get_external_id())
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
autotests = self.__autotest_api.api_v2_auto_tests_search_post(autotests_select_model=model)
|
|
86
87
|
|
|
87
|
-
if
|
|
88
|
-
self.__update_test(test_result,
|
|
88
|
+
if autotests:
|
|
89
|
+
self.__update_test(test_result, autotests[0].is_flaky)
|
|
89
90
|
|
|
90
|
-
autotest_global_id =
|
|
91
|
+
autotest_global_id = autotests[0].id
|
|
91
92
|
else:
|
|
92
93
|
autotest_global_id = self.__create_test(test_result)
|
|
93
94
|
|
|
@@ -97,16 +98,15 @@ class ApiClientWorker:
|
|
|
97
98
|
return self.__load_test_result(test_result)
|
|
98
99
|
|
|
99
100
|
@adapter_logger
|
|
100
|
-
def __get_work_items_linked_to_autotest(self, autotest_global_id: str) ->
|
|
101
|
+
def __get_work_items_linked_to_autotest(self, autotest_global_id: str) -> typing.List[WorkItemIdentifierModel]:
|
|
101
102
|
return self.__autotest_api.get_work_items_linked_to_auto_test(id=autotest_global_id)
|
|
102
103
|
|
|
103
104
|
@adapter_logger
|
|
104
105
|
def __update_autotest_link_from_work_items(self, autotest_global_id: str, work_item_ids: list):
|
|
105
|
-
|
|
106
106
|
linked_work_items = self.__get_work_items_linked_to_autotest(autotest_global_id)
|
|
107
107
|
|
|
108
108
|
for linked_work_item in linked_work_items:
|
|
109
|
-
linked_work_item_id = str(linked_work_item
|
|
109
|
+
linked_work_item_id = str(linked_work_item.global_id)
|
|
110
110
|
|
|
111
111
|
if linked_work_item_id in work_item_ids:
|
|
112
112
|
work_item_ids.remove(linked_work_item_id)
|
|
@@ -131,7 +131,7 @@ class ApiClientWorker:
|
|
|
131
131
|
|
|
132
132
|
logging.debug(f'Autotest "{test_result.get_autotest_name()}" was created')
|
|
133
133
|
|
|
134
|
-
return autotest_response
|
|
134
|
+
return autotest_response.id
|
|
135
135
|
|
|
136
136
|
@adapter_logger
|
|
137
137
|
def __update_test(self, test_result: TestResult, is_flaky: bool):
|
|
@@ -189,14 +189,10 @@ class ApiClientWorker:
|
|
|
189
189
|
model = Converter.convert_test_result_model_to_test_results_id_put_request(
|
|
190
190
|
self.get_test_result_by_id(test_result.get_test_result_id()))
|
|
191
191
|
|
|
192
|
-
model.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
test_result.
|
|
196
|
-
model.set_attribute(
|
|
197
|
-
"teardown_results",
|
|
198
|
-
Converter.step_results_to_attachment_put_model_autotest_step_results_model(
|
|
199
|
-
test_result.get_teardown_results()))
|
|
192
|
+
model.setup_results = Converter.step_results_to_auto_test_step_result_update_request(
|
|
193
|
+
test_result.get_setup_results())
|
|
194
|
+
model.teardown_results = Converter.step_results_to_auto_test_step_result_update_request(
|
|
195
|
+
test_result.get_teardown_results())
|
|
200
196
|
|
|
201
197
|
try:
|
|
202
198
|
self.__test_results_api.api_v2_test_results_id_put(
|
|
@@ -211,14 +207,16 @@ class ApiClientWorker:
|
|
|
211
207
|
|
|
212
208
|
for path in attach_paths:
|
|
213
209
|
if os.path.isfile(path):
|
|
214
|
-
|
|
215
|
-
|
|
210
|
+
with open(path, "rb+") as file:
|
|
211
|
+
try:
|
|
212
|
+
attachment_response = self.__attachments_api.api_v2_attachments_post(
|
|
213
|
+
file=(file.name, file.read()))
|
|
216
214
|
|
|
217
|
-
|
|
215
|
+
attachments.append(AttachmentPutModel(id=attachment_response.id))
|
|
218
216
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
logging.debug(f'Attachment "{path}" was uploaded')
|
|
218
|
+
except Exception as exc:
|
|
219
|
+
logging.error(f'Upload attachment "{path}" status: {exc}')
|
|
222
220
|
else:
|
|
223
221
|
logging.error(f'File "{path}" was not found!')
|
|
224
222
|
return attachments
|
|
@@ -2,6 +2,7 @@ import typing
|
|
|
2
2
|
|
|
3
3
|
from testit_api_client.models import (
|
|
4
4
|
AttachmentPutModelAutoTestStepResultsModel,
|
|
5
|
+
AutoTestStepResultUpdateRequest,
|
|
5
6
|
AutoTestPostModel,
|
|
6
7
|
AutoTestPutModel,
|
|
7
8
|
AutoTestResultsForTestRunModel,
|
|
@@ -11,11 +12,13 @@ from testit_api_client.models import (
|
|
|
11
12
|
LinkPutModel,
|
|
12
13
|
LinkType,
|
|
13
14
|
TestRunV2PostShortModel,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
TestRunV2GetModel,
|
|
16
|
+
AutotestFilterModel,
|
|
17
|
+
SearchAutoTestsQueryIncludesModel,
|
|
18
|
+
AutotestsSelectModel,
|
|
17
19
|
TestResultUpdateV2Request,
|
|
18
20
|
TestResultModel,
|
|
21
|
+
TestResultV2GetModel,
|
|
19
22
|
AttachmentModel,
|
|
20
23
|
AttachmentUpdateRequest
|
|
21
24
|
)
|
|
@@ -38,38 +41,38 @@ class Converter:
|
|
|
38
41
|
|
|
39
42
|
@classmethod
|
|
40
43
|
@adapter_logger
|
|
41
|
-
def get_id_from_create_test_run_response(cls, response):
|
|
42
|
-
return response
|
|
44
|
+
def get_id_from_create_test_run_response(cls, response: TestRunV2GetModel):
|
|
45
|
+
return response.id
|
|
43
46
|
|
|
44
47
|
@classmethod
|
|
45
48
|
@adapter_logger
|
|
46
|
-
def get_resolved_autotests_from_get_test_run_response(cls, response, configuration: str):
|
|
47
|
-
autotests = response
|
|
49
|
+
def get_resolved_autotests_from_get_test_run_response(cls, response: TestRunV2GetModel, configuration: str):
|
|
50
|
+
autotests = response.test_results
|
|
48
51
|
|
|
49
52
|
return cls.__get_resolved_autotests(autotests, configuration)
|
|
50
53
|
|
|
51
54
|
@classmethod
|
|
52
55
|
@adapter_logger
|
|
53
56
|
def project_id_and_external_id_to_auto_tests_search_post_request(cls, project_id: str, external_id: str):
|
|
54
|
-
autotests_filter =
|
|
57
|
+
autotests_filter = AutotestFilterModel(
|
|
55
58
|
project_ids=[project_id],
|
|
56
59
|
external_ids=[external_id],
|
|
57
60
|
is_deleted=False)
|
|
58
|
-
autotests_includes =
|
|
61
|
+
autotests_includes = SearchAutoTestsQueryIncludesModel(
|
|
59
62
|
include_steps=False,
|
|
60
63
|
include_links=False,
|
|
61
64
|
include_labels=False)
|
|
62
65
|
|
|
63
|
-
return
|
|
66
|
+
return AutotestsSelectModel(filter=autotests_filter, includes=autotests_includes)
|
|
64
67
|
|
|
65
68
|
@staticmethod
|
|
66
69
|
@adapter_logger
|
|
67
|
-
def __get_resolved_autotests(autotests:
|
|
70
|
+
def __get_resolved_autotests(autotests: typing.List[TestResultV2GetModel], configuration: str):
|
|
68
71
|
resolved_autotests = []
|
|
69
72
|
|
|
70
73
|
for autotest in autotests:
|
|
71
|
-
if configuration == autotest
|
|
72
|
-
resolved_autotests.append(autotest.
|
|
74
|
+
if configuration == autotest.configuration_id:
|
|
75
|
+
resolved_autotests.append(autotest.auto_test.external_id)
|
|
73
76
|
|
|
74
77
|
return resolved_autotests
|
|
75
78
|
|
|
@@ -324,3 +327,27 @@ class Converter:
|
|
|
324
327
|
)
|
|
325
328
|
|
|
326
329
|
return autotest_model_step_results
|
|
330
|
+
|
|
331
|
+
@classmethod
|
|
332
|
+
@adapter_logger
|
|
333
|
+
def step_results_to_auto_test_step_result_update_request(
|
|
334
|
+
cls, step_results: typing.List[StepResult]) -> typing.List[AutoTestStepResultUpdateRequest]:
|
|
335
|
+
autotest_model_step_results = []
|
|
336
|
+
|
|
337
|
+
for step_result in step_results:
|
|
338
|
+
autotest_model_step_results.append(
|
|
339
|
+
AutoTestStepResultUpdateRequest(
|
|
340
|
+
title=step_result.get_title(),
|
|
341
|
+
outcome=AvailableTestResultOutcome(step_result.get_outcome()),
|
|
342
|
+
description=step_result.get_description(),
|
|
343
|
+
duration=step_result.get_duration(),
|
|
344
|
+
parameters=step_result.get_parameters(),
|
|
345
|
+
attachments=step_result.get_attachments(),
|
|
346
|
+
started_on=step_result.get_started_on(),
|
|
347
|
+
completed_on=step_result.get_completed_on(),
|
|
348
|
+
step_results=cls.step_results_to_auto_test_step_result_update_request(
|
|
349
|
+
step_result.get_step_results())
|
|
350
|
+
)
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
return autotest_model_step_results
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.1
|
|
4
4
|
Summary: Python commons for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
Requires-Dist: pluggy
|
|
19
|
-
Requires-Dist: testit-api-client==
|
|
19
|
+
Requires-Dist: testit-api-client==5.0.0
|
|
20
20
|
|
|
21
21
|
# How to enable debug logging?
|
|
22
22
|
1. Add in **connection_config.ini** file from the root directory of the project:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/models/link.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.3.0 → testit_python_commons-3.3.1}/src/testit_python_commons/step.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|