testit-python-commons 3.6.3__tar.gz → 3.6.4__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.6.3 → testit_python_commons-3.6.4}/PKG-INFO +2 -1
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/setup.py +2 -2
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/app_properties.py +102 -44
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons.egg-info/PKG-INFO +2 -1
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons.egg-info/requires.txt +1 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/README.md +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/setup.cfg +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/__init__.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/client/__init__.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/client/api_client.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/client/client_configuration.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/client/converter.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/decorators.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/dynamic_methods.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/__init__.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/adapter_mode.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/fixture.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/link.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/link_type.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/outcome_type.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/step_result.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/test_result.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/models/test_result_with_all_fixture_step_results_model.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/__init__.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/adapter_manager.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/adapter_manager_configuration.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/fixture_manager.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/fixture_storage.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/logger.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/plugin_manager.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/retry.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/step_manager.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/step_result_storage.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/services/utils.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/step.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons.egg-info/SOURCES.txt +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons.egg-info/dependency_links.txt +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons.egg-info/top_level.txt +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/tests/test_app_properties.py +0 -0
- {testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/tests/test_dynamic_methods.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.4
|
|
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,6 +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: tomli
|
|
19
20
|
Requires-Dist: testit-api-client==6.2.0
|
|
20
21
|
Dynamic: author
|
|
21
22
|
Dynamic: author-email
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from setuptools import find_packages, setup
|
|
2
2
|
|
|
3
|
-
VERSION = "3.6.
|
|
3
|
+
VERSION = "3.6.4"
|
|
4
4
|
|
|
5
5
|
setup(
|
|
6
6
|
name='testit-python-commons',
|
|
@@ -25,5 +25,5 @@ setup(
|
|
|
25
25
|
py_modules=['testit', 'testit_python_commons'],
|
|
26
26
|
packages=find_packages(where='src'),
|
|
27
27
|
package_dir={'': 'src'},
|
|
28
|
-
install_requires=['pluggy', 'testit-api-client==6.2.0']
|
|
28
|
+
install_requires=['pluggy', 'tomli', 'testit-api-client==6.2.0']
|
|
29
29
|
)
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import configparser
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
|
-
import re
|
|
5
4
|
import warnings
|
|
6
5
|
import uuid
|
|
6
|
+
import re
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
|
+
import tomli
|
|
8
9
|
|
|
9
10
|
from testit_python_commons.models.adapter_mode import AdapterMode
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class AppProperties:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
__toml_extension = '.toml'
|
|
15
|
+
__ini_extension = '.ini'
|
|
16
|
+
__project_metadata_file = 'pyproject' + __toml_extension
|
|
17
|
+
__tms_config_file = 'connection_config' + __ini_extension
|
|
18
|
+
__properties_file = __tms_config_file
|
|
19
|
+
__available_extensions = [__toml_extension, __ini_extension]
|
|
16
20
|
|
|
17
21
|
__env_prefix = 'TMS'
|
|
22
|
+
__config_section_name = 'testit'
|
|
23
|
+
__debug_section_name = 'debug'
|
|
18
24
|
|
|
19
25
|
@staticmethod
|
|
20
26
|
def load_properties(option=None):
|
|
21
27
|
properties = AppProperties.load_file_properties(
|
|
22
28
|
option.set_config_file if hasattr(option, 'set_config_file') else None)
|
|
23
29
|
|
|
30
|
+
AppProperties.__check_token_property(properties)
|
|
31
|
+
|
|
24
32
|
properties.update(AppProperties.load_env_properties())
|
|
25
33
|
|
|
26
34
|
if option:
|
|
@@ -31,60 +39,41 @@ class AppProperties:
|
|
|
31
39
|
return properties
|
|
32
40
|
|
|
33
41
|
@classmethod
|
|
34
|
-
def load_file_properties(cls,
|
|
35
|
-
properties = {}
|
|
36
|
-
|
|
37
|
-
path = os.path.abspath('')
|
|
38
|
-
root = path[:path.index(os.sep)]
|
|
39
|
-
|
|
40
|
-
if file_name:
|
|
41
|
-
_, extension = os.path.splitext(file_name)
|
|
42
|
-
if extension not in cls.__available_extensions:
|
|
43
|
-
raise FileNotFoundError(
|
|
44
|
-
f'{file_name} is not a valid file. Available extensions: {cls.__available_extensions}'
|
|
45
|
-
)
|
|
46
|
-
cls.__properties_file = file_name
|
|
47
|
-
|
|
48
|
-
if os.environ.get(f'{cls.__env_prefix}_CONFIG_FILE'):
|
|
49
|
-
cls.__properties_file = os.environ.get(f'{cls.__env_prefix}_CONFIG_FILE')
|
|
50
|
-
|
|
42
|
+
def load_file_properties(cls, cli_file_path: str = None):
|
|
51
43
|
if os.path.isfile(cls.__project_metadata_file):
|
|
52
44
|
# https://peps.python.org/pep-0621/
|
|
53
45
|
cls.__properties_file = cls.__project_metadata_file
|
|
54
46
|
|
|
47
|
+
path = os.path.abspath('')
|
|
48
|
+
root = path[:path.index(os.sep)]
|
|
49
|
+
|
|
55
50
|
while not os.path.isfile(
|
|
56
|
-
path + os.sep + cls.
|
|
51
|
+
path + os.sep + cls.__tms_config_file) and path != root:
|
|
57
52
|
path = path[:path.rindex(os.sep)]
|
|
58
53
|
|
|
59
|
-
path = path + os.sep + cls.
|
|
54
|
+
path = path + os.sep + cls.__tms_config_file
|
|
60
55
|
|
|
61
56
|
if os.path.isfile(path):
|
|
62
|
-
|
|
57
|
+
cls.__properties_file = cls.__tms_config_file
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for key, value in parser.items('testit'):
|
|
68
|
-
properties[key] = cls.__search_in_environ(value)
|
|
59
|
+
if os.environ.get(f'{cls.__env_prefix}_CONFIG_FILE'):
|
|
60
|
+
cls.__properties_file = cls.__tms_config_file
|
|
61
|
+
path = os.environ.get(f'{cls.__env_prefix}_CONFIG_FILE')
|
|
69
62
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
parser.get('debug', 'tmsproxy'))
|
|
63
|
+
if cli_file_path:
|
|
64
|
+
cls.__properties_file = cls.__tms_config_file
|
|
65
|
+
path = cli_file_path
|
|
74
66
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
_, extension = os.path.splitext(cls.__properties_file)
|
|
68
|
+
if extension not in cls.__available_extensions:
|
|
69
|
+
raise FileNotFoundError(
|
|
70
|
+
f'{cls.__properties_file} is not a valid file ({_, extension}). Available extensions: {cls.__available_extensions}'
|
|
71
|
+
)
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
'The configuration file specifies a private token. It is not safe.'
|
|
82
|
-
' Use TMS_PRIVATE_TOKEN environment variable',
|
|
83
|
-
category=Warning,
|
|
84
|
-
stacklevel=2)
|
|
85
|
-
warnings.simplefilter('default', Warning)
|
|
73
|
+
if extension == cls.__toml_extension:
|
|
74
|
+
return cls.__load_file_properties_from_toml()
|
|
86
75
|
|
|
87
|
-
return
|
|
76
|
+
return cls.__load_file_properties_from_ini(path)
|
|
88
77
|
|
|
89
78
|
@classmethod
|
|
90
79
|
def load_cli_properties(cls, option):
|
|
@@ -250,6 +239,56 @@ class AppProperties:
|
|
|
250
239
|
if not cls.__check_property_value(properties.get('importrealtime')):
|
|
251
240
|
properties['importrealtime'] = 'true'
|
|
252
241
|
|
|
242
|
+
@classmethod
|
|
243
|
+
def __load_file_properties_from_toml(cls) -> dict:
|
|
244
|
+
properties = {}
|
|
245
|
+
|
|
246
|
+
with open(cls.__project_metadata_file, "rb+") as file:
|
|
247
|
+
toml_dict = tomli.load(file)
|
|
248
|
+
|
|
249
|
+
if not cls.__check_toml_section(toml_dict, cls.__config_section_name):
|
|
250
|
+
logging.error(f'Config section in "{cls.__properties_file}" file was not found!')
|
|
251
|
+
raise SystemExit
|
|
252
|
+
|
|
253
|
+
config_section = toml_dict.get(cls.__config_section_name)
|
|
254
|
+
|
|
255
|
+
for key, value in config_section.items():
|
|
256
|
+
properties[key.lower()] = cls.__search_in_environ(str(value))
|
|
257
|
+
|
|
258
|
+
if cls.__check_toml_section(toml_dict, cls.__debug_section_name):
|
|
259
|
+
debug_section = toml_dict.get(cls.__debug_section_name)
|
|
260
|
+
|
|
261
|
+
for key, value in debug_section.items():
|
|
262
|
+
if key == 'tmsproxy':
|
|
263
|
+
properties['tmsproxy'] = cls.__search_in_environ(str(value))
|
|
264
|
+
|
|
265
|
+
if key == '__dev':
|
|
266
|
+
properties['logs'] = cls.__search_in_environ(str(value)).lower()
|
|
267
|
+
|
|
268
|
+
return properties
|
|
269
|
+
|
|
270
|
+
@classmethod
|
|
271
|
+
def __load_file_properties_from_ini(cls, path: str) -> dict:
|
|
272
|
+
properties = {}
|
|
273
|
+
parser = configparser.RawConfigParser()
|
|
274
|
+
|
|
275
|
+
parser.read(path, encoding="utf-8")
|
|
276
|
+
|
|
277
|
+
if parser.has_section(cls.__config_section_name):
|
|
278
|
+
for key, value in parser.items(cls.__config_section_name):
|
|
279
|
+
properties[key] = cls.__search_in_environ(value)
|
|
280
|
+
|
|
281
|
+
if parser.has_section('debug'):
|
|
282
|
+
if parser.has_option('debug', 'tmsproxy'):
|
|
283
|
+
properties['tmsproxy'] = cls.__search_in_environ(
|
|
284
|
+
parser.get('debug', 'tmsproxy'))
|
|
285
|
+
|
|
286
|
+
if parser.has_option('debug', '__dev'):
|
|
287
|
+
properties['logs'] = cls.__search_in_environ(
|
|
288
|
+
parser.get('debug', '__dev')).lower()
|
|
289
|
+
|
|
290
|
+
return properties
|
|
291
|
+
|
|
253
292
|
@staticmethod
|
|
254
293
|
def __search_in_environ(var_name: str):
|
|
255
294
|
if re.fullmatch(r'{[a-zA-Z_]\w*}', var_name) and var_name[1:-1] in os.environ:
|
|
@@ -263,3 +302,22 @@ class AppProperties:
|
|
|
263
302
|
return True
|
|
264
303
|
|
|
265
304
|
return False
|
|
305
|
+
|
|
306
|
+
@staticmethod
|
|
307
|
+
def __check_toml_section(toml_dict: dict, section_name: str) -> bool:
|
|
308
|
+
if section_name not in toml_dict.keys():
|
|
309
|
+
return False
|
|
310
|
+
if not type(toml_dict.get(section_name)) is dict:
|
|
311
|
+
return False
|
|
312
|
+
|
|
313
|
+
return True
|
|
314
|
+
|
|
315
|
+
@staticmethod
|
|
316
|
+
def __check_token_property(properties: dict):
|
|
317
|
+
if 'privatetoken' in properties:
|
|
318
|
+
warnings.warn(
|
|
319
|
+
'The configuration file specifies a private token. It is not safe.'
|
|
320
|
+
' Use TMS_PRIVATE_TOKEN environment variable',
|
|
321
|
+
category=Warning,
|
|
322
|
+
stacklevel=2)
|
|
323
|
+
warnings.simplefilter('default', Warning)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: testit-python-commons
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.4
|
|
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,6 +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: tomli
|
|
19
20
|
Requires-Dist: testit-api-client==6.2.0
|
|
20
21
|
Dynamic: author
|
|
21
22
|
Dynamic: author-email
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/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.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/decorators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/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
|
|
File without changes
|
|
File without changes
|
{testit_python_commons-3.6.3 → testit_python_commons-3.6.4}/src/testit_python_commons/step.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|