qase-python-commons 4.0.0__tar.gz → 4.0.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.
Potentially problematic release.
This version of qase-python-commons might be problematic. Click here for more details.
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/PKG-INFO +8 -3
- qase_python_commons-4.0.1/README.md +14 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/pyproject.toml +2 -2
- qase_python_commons-4.0.1/src/qase/__init__.py +3 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/config.py +18 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/qaseconfig.py +6 -1
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/result.py +8 -2
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/core.py +32 -0
- qase_python_commons-4.0.1/src/qase/commons/status_mapping/__init__.py +12 -0
- qase_python_commons-4.0.1/src/qase/commons/status_mapping/status_mapping.py +237 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/PKG-INFO +8 -3
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/SOURCES.txt +3 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/requires.txt +1 -1
- qase_python_commons-4.0.0/README.md +0 -9
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/setup.cfg +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/__init__.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/api_v1_client.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/api_v2_client.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/base_api_client.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/exceptions/reporter.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/loader.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/logger.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/__init__.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/attachment.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/basemodel.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/api.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/batch.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/connection.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/framework.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/plan.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/report.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/run.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/testops.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/external_link.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/relation.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/run.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/runtime.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/step.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/__init__.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/db.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/network.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/sleep.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/__init__.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/report.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/testops.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/util/__init__.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/util/host_data.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/utils.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/validators/base.py +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/dependency_links.txt +0 -0
- {qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qase-python-commons
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: A library for Qase TestOps and Qase Report
|
|
5
5
|
Author-email: Qase Team <support@qase.io>
|
|
6
6
|
Project-URL: Homepage, https://github.com/qase-tms/qase-python/tree/main/qase-python-commons
|
|
@@ -21,7 +21,7 @@ Requires-Python: >=3.9
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
Requires-Dist: certifi>=2024.2.2
|
|
23
23
|
Requires-Dist: attrs>=23.2.0
|
|
24
|
-
Requires-Dist: qase-api-client~=2.0.
|
|
24
|
+
Requires-Dist: qase-api-client~=2.0.1
|
|
25
25
|
Requires-Dist: qase-api-v2-client~=2.0.0
|
|
26
26
|
Requires-Dist: more_itertools
|
|
27
27
|
Provides-Extra: testing
|
|
@@ -36,7 +36,12 @@ Requires-Dist: urllib3; extra == "testing"
|
|
|
36
36
|
|
|
37
37
|
## Description
|
|
38
38
|
|
|
39
|
-
This package contains reporters for Qase TestOps and Qase Report that are used in
|
|
39
|
+
This package contains reporters for Qase TestOps and Qase Report that are used in following projects:
|
|
40
|
+
|
|
41
|
+
- [qase-pytest](https://github.com/qase-tms/qase-python/tree/main/qase-pytest)
|
|
42
|
+
- [qase-robotframework](https://github.com/qase-tms/qase-python/tree/main/qase-robotframework)
|
|
43
|
+
- [qase-behave](https://github.com/qase-tms/qase-python/tree/main/qase-behave)
|
|
44
|
+
- [qase-tavern](https://github.com/qase-tms/qase-python/tree/main/qase-tavern)
|
|
40
45
|
|
|
41
46
|
## How to install
|
|
42
47
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Qase Python Commons
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
This package contains reporters for Qase TestOps and Qase Report that are used in following projects:
|
|
6
|
+
|
|
7
|
+
- [qase-pytest](https://github.com/qase-tms/qase-python/tree/main/qase-pytest)
|
|
8
|
+
- [qase-robotframework](https://github.com/qase-tms/qase-python/tree/main/qase-robotframework)
|
|
9
|
+
- [qase-behave](https://github.com/qase-tms/qase-python/tree/main/qase-behave)
|
|
10
|
+
- [qase-tavern](https://github.com/qase-tms/qase-python/tree/main/qase-tavern)
|
|
11
|
+
|
|
12
|
+
## How to install
|
|
13
|
+
|
|
14
|
+
`pip install qase-python-commons`
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qase-python-commons"
|
|
7
|
-
version = "4.0.
|
|
7
|
+
version = "4.0.1"
|
|
8
8
|
description = "A library for Qase TestOps and Qase Report"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{name = "Qase Team", email = "support@qase.io"}]
|
|
@@ -29,7 +29,7 @@ requires-python = ">=3.9"
|
|
|
29
29
|
dependencies = [
|
|
30
30
|
"certifi>=2024.2.2",
|
|
31
31
|
"attrs>=23.2.0",
|
|
32
|
-
"qase-api-client~=2.0.
|
|
32
|
+
"qase-api-client~=2.0.1",
|
|
33
33
|
"qase-api-v2-client~=2.0.0",
|
|
34
34
|
"more_itertools"
|
|
35
35
|
]
|
|
@@ -63,6 +63,11 @@ class ConfigManager:
|
|
|
63
63
|
config.get("excludeParams")
|
|
64
64
|
)
|
|
65
65
|
|
|
66
|
+
if config.get("statusMapping"):
|
|
67
|
+
self.config.set_status_mapping(
|
|
68
|
+
config.get("statusMapping")
|
|
69
|
+
)
|
|
70
|
+
|
|
66
71
|
if config.get("executionPlan"):
|
|
67
72
|
execution_plan = config.get("executionPlan")
|
|
68
73
|
if execution_plan.get("path"):
|
|
@@ -224,6 +229,19 @@ class ConfigManager:
|
|
|
224
229
|
self.config.set_exclude_params(
|
|
225
230
|
[param.strip() for param in value.split(',')])
|
|
226
231
|
|
|
232
|
+
if key == 'QASE_STATUS_MAPPING':
|
|
233
|
+
# Parse status mapping from environment variable
|
|
234
|
+
# Format: "source1=target1,source2=target2"
|
|
235
|
+
if value:
|
|
236
|
+
mapping_dict = {}
|
|
237
|
+
pairs = value.split(',')
|
|
238
|
+
for pair in pairs:
|
|
239
|
+
pair = pair.strip()
|
|
240
|
+
if pair and '=' in pair:
|
|
241
|
+
source_status, target_status = pair.split('=', 1)
|
|
242
|
+
mapping_dict[source_status.strip()] = target_status.strip()
|
|
243
|
+
self.config.set_status_mapping(mapping_dict)
|
|
244
|
+
|
|
227
245
|
if key == 'QASE_EXECUTION_PLAN_PATH':
|
|
228
246
|
self.config.execution_plan.set_path(value)
|
|
229
247
|
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/qaseconfig.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
|
-
from typing import List
|
|
2
|
+
from typing import List, Dict
|
|
3
3
|
|
|
4
4
|
from .framework import Framework
|
|
5
5
|
from .report import ReportConfig
|
|
@@ -36,6 +36,7 @@ class QaseConfig(BaseModel):
|
|
|
36
36
|
profilers: list = None
|
|
37
37
|
framework: Framework = None
|
|
38
38
|
exclude_params: list = None
|
|
39
|
+
status_mapping: Dict[str, str] = None
|
|
39
40
|
|
|
40
41
|
def __init__(self):
|
|
41
42
|
self.mode = Mode.off
|
|
@@ -47,6 +48,7 @@ class QaseConfig(BaseModel):
|
|
|
47
48
|
self.framework = Framework()
|
|
48
49
|
self.profilers = []
|
|
49
50
|
self.exclude_params = []
|
|
51
|
+
self.status_mapping = {}
|
|
50
52
|
|
|
51
53
|
def set_mode(self, mode: str):
|
|
52
54
|
if any(mode == e.value for e in Mode.__members__.values()):
|
|
@@ -70,3 +72,6 @@ class QaseConfig(BaseModel):
|
|
|
70
72
|
|
|
71
73
|
def set_exclude_params(self, exclude_params: List[str]):
|
|
72
74
|
self.exclude_params = exclude_params
|
|
75
|
+
|
|
76
|
+
def set_status_mapping(self, status_mapping: Dict[str, str]):
|
|
77
|
+
self.status_mapping = status_mapping
|
|
@@ -33,10 +33,16 @@ class Execution(BaseModel):
|
|
|
33
33
|
self.thread = thread
|
|
34
34
|
|
|
35
35
|
def set_status(self, status: Optional[str]):
|
|
36
|
-
if status
|
|
36
|
+
if status is None:
|
|
37
37
|
self.status = status
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
# Convert to lowercase for validation
|
|
41
|
+
status_lower = status.lower()
|
|
42
|
+
if status_lower in ['passed', 'failed', 'skipped', 'untested', 'invalid', 'disabled', 'blocked']:
|
|
43
|
+
self.status = status_lower
|
|
38
44
|
else:
|
|
39
|
-
raise ValueError('Step status must be one of: passed, failed, skipped, untested, invalid')
|
|
45
|
+
raise ValueError('Step status must be one of: passed, failed, skipped, untested, invalid, disabled, blocked')
|
|
40
46
|
|
|
41
47
|
def get_status(self):
|
|
42
48
|
return self.status
|
|
@@ -11,6 +11,7 @@ from ..models.config.qaseconfig import Mode
|
|
|
11
11
|
from typing import Union, List
|
|
12
12
|
|
|
13
13
|
from ..util import get_host_info
|
|
14
|
+
from ..status_mapping.status_mapping import StatusMapping
|
|
14
15
|
|
|
15
16
|
"""
|
|
16
17
|
CoreReporter is a facade for all reporters and it is used to initialize and manage them.
|
|
@@ -28,6 +29,11 @@ class QaseCoreReporter:
|
|
|
28
29
|
self.profilers = []
|
|
29
30
|
self.overhead = 0
|
|
30
31
|
|
|
32
|
+
# Initialize status mapping
|
|
33
|
+
self.status_mapping = StatusMapping.from_dict(self.config.status_mapping)
|
|
34
|
+
if not self.status_mapping.is_empty():
|
|
35
|
+
self.logger.log_debug(f"Status mapping initialized: {self.status_mapping}")
|
|
36
|
+
|
|
31
37
|
# self._selective_execution_setup()
|
|
32
38
|
self.fallback = self._fallback_setup()
|
|
33
39
|
|
|
@@ -87,6 +93,9 @@ class QaseCoreReporter:
|
|
|
87
93
|
ts = time.time()
|
|
88
94
|
self.logger.log_debug(f"Adding result {result}")
|
|
89
95
|
|
|
96
|
+
# Apply status mapping before adding result
|
|
97
|
+
self._apply_status_mapping(result)
|
|
98
|
+
|
|
90
99
|
self.reporter.add_result(result)
|
|
91
100
|
|
|
92
101
|
self.logger.log_debug(f"Result {result.get_title()} added")
|
|
@@ -208,3 +217,26 @@ class QaseCoreReporter:
|
|
|
208
217
|
if self.config.fallback == Mode.report:
|
|
209
218
|
return QaseReport(config=self.config, logger=self.logger)
|
|
210
219
|
return None
|
|
220
|
+
|
|
221
|
+
def _apply_status_mapping(self, result: Result) -> None:
|
|
222
|
+
"""
|
|
223
|
+
Apply status mapping to a test result.
|
|
224
|
+
|
|
225
|
+
This method applies the configured status mapping to the result's execution status.
|
|
226
|
+
The mapping is applied before the result is sent to the reporter.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
result: Test result to apply status mapping to
|
|
230
|
+
"""
|
|
231
|
+
if self.status_mapping.is_empty():
|
|
232
|
+
return
|
|
233
|
+
|
|
234
|
+
original_status = result.get_status()
|
|
235
|
+
if not original_status:
|
|
236
|
+
return
|
|
237
|
+
|
|
238
|
+
mapped_status = self.status_mapping.apply_mapping(original_status)
|
|
239
|
+
|
|
240
|
+
if mapped_status != original_status:
|
|
241
|
+
result.execution.set_status(mapped_status)
|
|
242
|
+
self.logger.log_debug(f"Status mapped for '{result.get_title()}': {original_status} -> {mapped_status}")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utilities package for Qase Python Commons.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .status_mapping import StatusMapping, StatusMappingError, create_status_mapping_from_config, create_status_mapping_from_env
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
'StatusMapping',
|
|
9
|
+
'StatusMappingError',
|
|
10
|
+
'create_status_mapping_from_config',
|
|
11
|
+
'create_status_mapping_from_env'
|
|
12
|
+
]
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Status mapping utilities for Qase Python Commons.
|
|
3
|
+
|
|
4
|
+
This module provides functionality to map test result statuses from one value to another
|
|
5
|
+
based on configuration. This is useful for standardizing status values across different
|
|
6
|
+
testing frameworks or for custom status transformations.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Dict, Optional, List
|
|
10
|
+
import os
|
|
11
|
+
import logging
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class StatusMappingError(Exception):
|
|
15
|
+
"""Exception raised when status mapping encounters an error."""
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class StatusMapping:
|
|
20
|
+
"""
|
|
21
|
+
Handles mapping of test result statuses.
|
|
22
|
+
|
|
23
|
+
This class provides functionality to:
|
|
24
|
+
- Parse status mapping from configuration
|
|
25
|
+
- Validate status mappings
|
|
26
|
+
- Apply status mappings to test results
|
|
27
|
+
- Support both JSON configuration and environment variables
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
# Valid statuses that can be mapped
|
|
31
|
+
VALID_STATUSES = {
|
|
32
|
+
'passed', 'failed', 'skipped', 'disabled', 'blocked', 'invalid'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def __init__(self, mapping: Optional[Dict[str, str]] = None):
|
|
36
|
+
"""
|
|
37
|
+
Initialize StatusMapping with optional mapping dictionary.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
mapping: Dictionary mapping source status to target status
|
|
41
|
+
"""
|
|
42
|
+
self.mapping = mapping or {}
|
|
43
|
+
self.logger = logging.getLogger(__name__)
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def from_dict(cls, mapping_dict: Dict[str, str]) -> 'StatusMapping':
|
|
47
|
+
"""
|
|
48
|
+
Create StatusMapping from dictionary.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
mapping_dict: Dictionary with status mappings
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
StatusMapping instance
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
StatusMappingError: If mapping contains invalid statuses
|
|
58
|
+
"""
|
|
59
|
+
instance = cls()
|
|
60
|
+
instance.set_mapping(mapping_dict)
|
|
61
|
+
return instance
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_env_string(cls, env_string: str) -> 'StatusMapping':
|
|
65
|
+
"""
|
|
66
|
+
Create StatusMapping from environment variable string.
|
|
67
|
+
|
|
68
|
+
Expected format: "source1=target1,source2=target2"
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
env_string: Environment variable string
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
StatusMapping instance
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
StatusMappingError: If string format is invalid
|
|
78
|
+
"""
|
|
79
|
+
instance = cls()
|
|
80
|
+
instance.parse_env_string(env_string)
|
|
81
|
+
return instance
|
|
82
|
+
|
|
83
|
+
def set_mapping(self, mapping_dict: Dict[str, str]) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Set status mapping from dictionary.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
mapping_dict: Dictionary with status mappings
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
StatusMappingError: If mapping contains invalid statuses
|
|
92
|
+
"""
|
|
93
|
+
if not isinstance(mapping_dict, dict):
|
|
94
|
+
raise StatusMappingError("Mapping must be a dictionary")
|
|
95
|
+
|
|
96
|
+
# Validate all statuses in the mapping
|
|
97
|
+
for source_status, target_status in mapping_dict.items():
|
|
98
|
+
if source_status not in self.VALID_STATUSES:
|
|
99
|
+
raise StatusMappingError(f"Invalid source status: {source_status}")
|
|
100
|
+
if target_status not in self.VALID_STATUSES:
|
|
101
|
+
raise StatusMappingError(f"Invalid target status: {target_status}")
|
|
102
|
+
|
|
103
|
+
self.mapping = mapping_dict.copy()
|
|
104
|
+
self.logger.debug(f"Status mapping set: {self.mapping}")
|
|
105
|
+
|
|
106
|
+
def parse_env_string(self, env_string: str) -> None:
|
|
107
|
+
"""
|
|
108
|
+
Parse status mapping from environment variable string.
|
|
109
|
+
|
|
110
|
+
Expected format: "source1=target1,source2=target2"
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
env_string: Environment variable string
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
StatusMappingError: If string format is invalid
|
|
117
|
+
"""
|
|
118
|
+
if not env_string or not env_string.strip():
|
|
119
|
+
self.mapping = {}
|
|
120
|
+
return
|
|
121
|
+
|
|
122
|
+
mapping_dict = {}
|
|
123
|
+
pairs = env_string.split(',')
|
|
124
|
+
|
|
125
|
+
for pair in pairs:
|
|
126
|
+
pair = pair.strip()
|
|
127
|
+
if not pair:
|
|
128
|
+
continue
|
|
129
|
+
|
|
130
|
+
if '=' not in pair:
|
|
131
|
+
raise StatusMappingError(f"Invalid mapping format: {pair}. Expected 'source=target'")
|
|
132
|
+
|
|
133
|
+
source_status, target_status = pair.split('=', 1)
|
|
134
|
+
source_status = source_status.strip()
|
|
135
|
+
target_status = target_status.strip()
|
|
136
|
+
|
|
137
|
+
if not source_status or not target_status:
|
|
138
|
+
raise StatusMappingError(f"Empty status in mapping: {pair}")
|
|
139
|
+
|
|
140
|
+
mapping_dict[source_status] = target_status
|
|
141
|
+
|
|
142
|
+
self.set_mapping(mapping_dict)
|
|
143
|
+
|
|
144
|
+
def apply_mapping(self, status: str) -> str:
|
|
145
|
+
"""
|
|
146
|
+
Apply status mapping to a given status.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
status: Original status
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
Mapped status if mapping exists, otherwise original status
|
|
153
|
+
"""
|
|
154
|
+
if not status:
|
|
155
|
+
return status
|
|
156
|
+
|
|
157
|
+
if status in self.mapping:
|
|
158
|
+
mapped_status = self.mapping[status]
|
|
159
|
+
self.logger.debug(f"Status mapped: {status} -> {mapped_status}")
|
|
160
|
+
return mapped_status
|
|
161
|
+
|
|
162
|
+
return status
|
|
163
|
+
|
|
164
|
+
def get_mapping(self) -> Dict[str, str]:
|
|
165
|
+
"""
|
|
166
|
+
Get current status mapping.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Dictionary with current status mappings
|
|
170
|
+
"""
|
|
171
|
+
return self.mapping.copy()
|
|
172
|
+
|
|
173
|
+
def is_empty(self) -> bool:
|
|
174
|
+
"""
|
|
175
|
+
Check if mapping is empty.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
True if no mappings are defined
|
|
179
|
+
"""
|
|
180
|
+
return len(self.mapping) == 0
|
|
181
|
+
|
|
182
|
+
def validate(self) -> List[str]:
|
|
183
|
+
"""
|
|
184
|
+
Validate current mapping and return any issues.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
List of validation error messages
|
|
188
|
+
"""
|
|
189
|
+
errors = []
|
|
190
|
+
|
|
191
|
+
for source_status, target_status in self.mapping.items():
|
|
192
|
+
if source_status not in self.VALID_STATUSES:
|
|
193
|
+
errors.append(f"Invalid source status: {source_status}")
|
|
194
|
+
if target_status not in self.VALID_STATUSES:
|
|
195
|
+
errors.append(f"Invalid target status: {target_status}")
|
|
196
|
+
|
|
197
|
+
return errors
|
|
198
|
+
|
|
199
|
+
def __str__(self) -> str:
|
|
200
|
+
"""String representation of the mapping."""
|
|
201
|
+
return str(self.mapping)
|
|
202
|
+
|
|
203
|
+
def __repr__(self) -> str:
|
|
204
|
+
"""Detailed string representation."""
|
|
205
|
+
return f"StatusMapping({self.mapping})"
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def create_status_mapping_from_config(config_value: Optional[Dict[str, str]]) -> StatusMapping:
|
|
209
|
+
"""
|
|
210
|
+
Create StatusMapping from configuration value.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
config_value: Configuration dictionary or None
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
StatusMapping instance
|
|
217
|
+
"""
|
|
218
|
+
if config_value is None:
|
|
219
|
+
return StatusMapping()
|
|
220
|
+
|
|
221
|
+
return StatusMapping.from_dict(config_value)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def create_status_mapping_from_env(env_var_name: str = 'STATUS_MAPPING') -> StatusMapping:
|
|
225
|
+
"""
|
|
226
|
+
Create StatusMapping from environment variable.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
env_var_name: Name of environment variable
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
StatusMapping instance
|
|
233
|
+
"""
|
|
234
|
+
env_value = os.getenv(env_var_name)
|
|
235
|
+
if env_value:
|
|
236
|
+
return StatusMapping.from_env_string(env_value)
|
|
237
|
+
return StatusMapping()
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qase-python-commons
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: A library for Qase TestOps and Qase Report
|
|
5
5
|
Author-email: Qase Team <support@qase.io>
|
|
6
6
|
Project-URL: Homepage, https://github.com/qase-tms/qase-python/tree/main/qase-python-commons
|
|
@@ -21,7 +21,7 @@ Requires-Python: >=3.9
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
Requires-Dist: certifi>=2024.2.2
|
|
23
23
|
Requires-Dist: attrs>=23.2.0
|
|
24
|
-
Requires-Dist: qase-api-client~=2.0.
|
|
24
|
+
Requires-Dist: qase-api-client~=2.0.1
|
|
25
25
|
Requires-Dist: qase-api-v2-client~=2.0.0
|
|
26
26
|
Requires-Dist: more_itertools
|
|
27
27
|
Provides-Extra: testing
|
|
@@ -36,7 +36,12 @@ Requires-Dist: urllib3; extra == "testing"
|
|
|
36
36
|
|
|
37
37
|
## Description
|
|
38
38
|
|
|
39
|
-
This package contains reporters for Qase TestOps and Qase Report that are used in
|
|
39
|
+
This package contains reporters for Qase TestOps and Qase Report that are used in following projects:
|
|
40
|
+
|
|
41
|
+
- [qase-pytest](https://github.com/qase-tms/qase-python/tree/main/qase-pytest)
|
|
42
|
+
- [qase-robotframework](https://github.com/qase-tms/qase-python/tree/main/qase-robotframework)
|
|
43
|
+
- [qase-behave](https://github.com/qase-tms/qase-python/tree/main/qase-behave)
|
|
44
|
+
- [qase-tavern](https://github.com/qase-tms/qase-python/tree/main/qase-tavern)
|
|
40
45
|
|
|
41
46
|
## How to install
|
|
42
47
|
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase_python_commons.egg-info/SOURCES.txt
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
pyproject.toml
|
|
3
|
+
src/qase/__init__.py
|
|
3
4
|
src/qase/commons/__init__.py
|
|
4
5
|
src/qase/commons/config.py
|
|
5
6
|
src/qase/commons/loader.py
|
|
@@ -35,6 +36,8 @@ src/qase/commons/reporters/__init__.py
|
|
|
35
36
|
src/qase/commons/reporters/core.py
|
|
36
37
|
src/qase/commons/reporters/report.py
|
|
37
38
|
src/qase/commons/reporters/testops.py
|
|
39
|
+
src/qase/commons/status_mapping/__init__.py
|
|
40
|
+
src/qase/commons/status_mapping/status_mapping.py
|
|
38
41
|
src/qase/commons/util/__init__.py
|
|
39
42
|
src/qase/commons/util/host_data.py
|
|
40
43
|
src/qase/commons/validators/base.py
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Qase Python Commons
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
|
|
5
|
-
This package contains reporters for Qase TestOps and Qase Report that are used in [qase-pytest](https://github.com/qase-tms/qase-python/tree/master/qase-pytest) and [qase-robotframework](https://github.com/qase-tms/qase-python/tree/master/qase-robotframework).
|
|
6
|
-
|
|
7
|
-
## How to install
|
|
8
|
-
|
|
9
|
-
`pip install qase-python-commons`
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/api_v1_client.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/api_v2_client.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/client/base_api_client.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/exceptions/reporter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/attachment.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/basemodel.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/api.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/batch.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/connection.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/framework.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/plan.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/report.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/run.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/config/testops.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/models/external_link.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/profilers/network.py
RENAMED
|
File without changes
|
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/__init__.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/report.py
RENAMED
|
File without changes
|
{qase_python_commons-4.0.0 → qase_python_commons-4.0.1}/src/qase/commons/reporters/testops.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|