testit-python-commons 3.1.1__tar.gz → 3.2.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.1.1 → testit_python_commons-3.2.1}/PKG-INFO +2 -2
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/setup.py +2 -2
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/client/api_client.py +63 -26
- testit_python_commons-3.2.1/src/testit_python_commons/services/retry.py +23 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons.egg-info/PKG-INFO +2 -2
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons.egg-info/SOURCES.txt +1 -0
- testit_python_commons-3.2.1/src/testit_python_commons.egg-info/requires.txt +2 -0
- testit_python_commons-3.1.1/src/testit_python_commons.egg-info/requires.txt +0 -2
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/README.md +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/setup.cfg +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/__init__.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/app_properties.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/client/__init__.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/client/client_configuration.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/client/converter.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/decorators.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/dynamic_methods.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/__init__.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/adapter_mode.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/link.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/link_type.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/outcome_type.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/step_result.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/test_result.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/__init__.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/adapter_manager.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/logger.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/plugin_manager.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/step_manager.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/step_result_storage.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/services/utils.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/step.py +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
- {testit_python_commons-3.1.1 → testit_python_commons-3.2.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
|
+
Version: 3.2.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==4.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.
|
|
5
|
+
version='3.2.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==4.0.0']
|
|
27
27
|
)
|
|
@@ -14,30 +14,42 @@ from testit_api_client.models import (
|
|
|
14
14
|
from testit_python_commons.client.client_configuration import ClientConfiguration
|
|
15
15
|
from testit_python_commons.client.converter import Converter
|
|
16
16
|
from testit_python_commons.models.test_result import TestResult
|
|
17
|
-
from testit_python_commons.models.test_result_with_all_fixture_step_results_model import
|
|
17
|
+
from testit_python_commons.models.test_result_with_all_fixture_step_results_model import \
|
|
18
|
+
TestResultWithAllFixtureStepResults
|
|
18
19
|
from testit_python_commons.services.logger import adapter_logger
|
|
20
|
+
from testit_python_commons.services.retry import retry
|
|
19
21
|
|
|
20
22
|
|
|
21
23
|
class ApiClientWorker:
|
|
22
24
|
def __init__(self, config: ClientConfiguration):
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
client_config.proxy = config.get_proxy()
|
|
29
|
-
|
|
30
|
-
api_client = ApiClient(
|
|
31
|
-
configuration=client_config,
|
|
32
|
-
header_name='Authorization',
|
|
33
|
-
header_value='PrivateToken ' + config.get_private_token()
|
|
34
|
-
)
|
|
35
|
-
self.__config = config
|
|
25
|
+
api_client_config = self.__get_api_client_configuration(
|
|
26
|
+
url=config.get_url(),
|
|
27
|
+
verify_ssl=config.get_cert_validation() != 'false',
|
|
28
|
+
proxy=config.get_proxy())
|
|
29
|
+
api_client = self.__get_api_client(api_client_config, config.get_private_token())
|
|
36
30
|
|
|
37
31
|
self.__test_run_api = TestRunsApi(api_client=api_client)
|
|
38
32
|
self.__autotest_api = AutoTestsApi(api_client=api_client)
|
|
39
33
|
self.__attachments_api = AttachmentsApi(api_client=api_client)
|
|
40
34
|
self.__test_results_api = TestResultsApi(api_client=api_client)
|
|
35
|
+
self.__config = config
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
@adapter_logger
|
|
39
|
+
def __get_api_client_configuration(url: str, verify_ssl: bool = True, proxy: str = None) -> Configuration:
|
|
40
|
+
api_client_configuration = Configuration(host=url)
|
|
41
|
+
api_client_configuration.verify_ssl = verify_ssl
|
|
42
|
+
api_client_configuration.proxy = proxy
|
|
43
|
+
|
|
44
|
+
return api_client_configuration
|
|
45
|
+
|
|
46
|
+
@staticmethod
|
|
47
|
+
@adapter_logger
|
|
48
|
+
def __get_api_client(api_client_config: Configuration, token: str) -> ApiClient:
|
|
49
|
+
return ApiClient(
|
|
50
|
+
configuration=api_client_config,
|
|
51
|
+
header_name='Authorization',
|
|
52
|
+
header_value='PrivateToken ' + token)
|
|
41
53
|
|
|
42
54
|
@adapter_logger
|
|
43
55
|
def create_test_run(self):
|
|
@@ -76,16 +88,35 @@ class ApiClientWorker:
|
|
|
76
88
|
self.__update_test(test_result, autotest[0]['is_flaky'])
|
|
77
89
|
|
|
78
90
|
autotest_global_id = autotest[0]['id']
|
|
79
|
-
|
|
80
|
-
self.__autotest_api.delete_auto_test_link_from_work_item(id=autotest_global_id)
|
|
81
91
|
else:
|
|
82
92
|
autotest_global_id = self.__create_test(test_result)
|
|
83
93
|
|
|
84
94
|
if autotest_global_id:
|
|
85
|
-
self.
|
|
95
|
+
self.__update_autotest_link_from_work_items(autotest_global_id, test_result.get_work_item_ids())
|
|
86
96
|
|
|
87
97
|
return self.__load_test_result(test_result)
|
|
88
98
|
|
|
99
|
+
@adapter_logger
|
|
100
|
+
def __get_work_items_linked_to_autotest(self, autotest_global_id: str) -> list:
|
|
101
|
+
return self.__autotest_api.get_work_items_linked_to_auto_test(id=autotest_global_id)
|
|
102
|
+
|
|
103
|
+
@adapter_logger
|
|
104
|
+
def __update_autotest_link_from_work_items(self, autotest_global_id: str, work_item_ids: list):
|
|
105
|
+
linked_work_items = self.__get_work_items_linked_to_autotest(autotest_global_id)
|
|
106
|
+
|
|
107
|
+
for linked_work_item in linked_work_items:
|
|
108
|
+
linked_work_item_id = str(linked_work_item['global_id'])
|
|
109
|
+
|
|
110
|
+
if linked_work_item_id in work_item_ids:
|
|
111
|
+
work_item_ids.remove(linked_work_item_id)
|
|
112
|
+
|
|
113
|
+
continue
|
|
114
|
+
|
|
115
|
+
self.__unlink_test_to_work_item(autotest_global_id, linked_work_item_id)
|
|
116
|
+
|
|
117
|
+
for work_item_id in work_item_ids:
|
|
118
|
+
self.__link_test_to_work_item(autotest_global_id, work_item_id)
|
|
119
|
+
|
|
89
120
|
@adapter_logger
|
|
90
121
|
def __create_test(self, test_result: TestResult) -> str:
|
|
91
122
|
logging.debug(f'Autotest "{test_result.get_autotest_name()}" was not found')
|
|
@@ -114,16 +145,22 @@ class ApiClientWorker:
|
|
|
114
145
|
logging.debug(f'Autotest "{test_result.get_autotest_name()}" was updated')
|
|
115
146
|
|
|
116
147
|
@adapter_logger
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
link_auto_test_to_work_item_request=LinkAutoTestToWorkItemRequest(id=work_item_id))
|
|
148
|
+
@retry
|
|
149
|
+
def __unlink_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
150
|
+
self.__autotest_api.delete_auto_test_link_from_work_item(
|
|
151
|
+
id=autotest_global_id,
|
|
152
|
+
work_item_id=work_item_id)
|
|
123
153
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
154
|
+
logging.debug(f'Autotest was unlinked with workItem "{work_item_id}" by global id "{autotest_global_id}')
|
|
155
|
+
|
|
156
|
+
@adapter_logger
|
|
157
|
+
@retry
|
|
158
|
+
def __link_test_to_work_item(self, autotest_global_id: str, work_item_id: str):
|
|
159
|
+
self.__autotest_api.link_auto_test_to_work_item(
|
|
160
|
+
autotest_global_id,
|
|
161
|
+
link_auto_test_to_work_item_request=LinkAutoTestToWorkItemRequest(id=work_item_id))
|
|
162
|
+
|
|
163
|
+
logging.debug(f'Autotest was linked with workItem "{work_item_id}" by global id "{autotest_global_id}')
|
|
127
164
|
|
|
128
165
|
@adapter_logger
|
|
129
166
|
def __load_test_result(self, test_result: TestResult) -> str:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import random
|
|
3
|
+
import time
|
|
4
|
+
|
|
5
|
+
import testit_api_client
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def retry(func):
|
|
9
|
+
def retry_wrapper(*args, **kwargs):
|
|
10
|
+
attempts = 0
|
|
11
|
+
retries = 10
|
|
12
|
+
|
|
13
|
+
while attempts < retries:
|
|
14
|
+
try:
|
|
15
|
+
return func(*args, **kwargs)
|
|
16
|
+
except testit_api_client.exceptions.ApiException as e:
|
|
17
|
+
sleep_time = random.randrange(0, 100)
|
|
18
|
+
time.sleep(sleep_time/100)
|
|
19
|
+
attempts += 1
|
|
20
|
+
|
|
21
|
+
logging.error(e)
|
|
22
|
+
|
|
23
|
+
return retry_wrapper
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.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==4.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:
|
|
@@ -28,6 +28,7 @@ src/testit_python_commons/services/adapter_manager.py
|
|
|
28
28
|
src/testit_python_commons/services/adapter_manager_configuration.py
|
|
29
29
|
src/testit_python_commons/services/logger.py
|
|
30
30
|
src/testit_python_commons/services/plugin_manager.py
|
|
31
|
+
src/testit_python_commons/services/retry.py
|
|
31
32
|
src/testit_python_commons/services/step_manager.py
|
|
32
33
|
src/testit_python_commons/services/step_result_storage.py
|
|
33
34
|
src/testit_python_commons/services/utils.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.1.1 → testit_python_commons-3.2.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
|
{testit_python_commons-3.1.1 → testit_python_commons-3.2.1}/src/testit_python_commons/step.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|