qase-python-commons 3.4.0__tar.gz → 3.4.2__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-3.4.0 → qase_python_commons-3.4.2}/PKG-INFO +1 -1
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/pyproject.toml +1 -1
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/api_v2_client.py +7 -7
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/config.py +4 -4
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/logger.py +6 -1
- qase_python_commons-3.4.2/src/qase/commons/models/basemodel.py +16 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/result.py +0 -6
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/run.py +14 -2
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/step.py +6 -2
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/report.py +2 -3
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase_python_commons.egg-info/PKG-INFO +1 -1
- qase_python_commons-3.4.0/src/qase/commons/models/basemodel.py +0 -7
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/README.md +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/setup.cfg +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/__init__.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/api_v1_client.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/base_api_client.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/exceptions/reporter.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/loader.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/__init__.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/attachment.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/api.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/batch.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/connection.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/framework.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/plan.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/qaseconfig.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/report.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/run.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/testops.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/relation.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/runtime.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/__init__.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/db.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/network.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/sleep.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/__init__.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/core.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/testops.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/util/__init__.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/util/host_data.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/utils.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/validators/base.py +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase_python_commons.egg-info/SOURCES.txt +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase_python_commons.egg-info/dependency_links.txt +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase_python_commons.egg-info/requires.txt +0 -0
- {qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/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: 3.4.
|
|
3
|
+
Version: 3.4.2
|
|
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
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qase-python-commons"
|
|
7
|
-
version = "3.4.
|
|
7
|
+
version = "3.4.2"
|
|
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"}]
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/api_v2_client.py
RENAMED
|
@@ -125,18 +125,18 @@ class ApiV2Client(ApiV1Client):
|
|
|
125
125
|
prepared_step['data']['action'] = step.data.request_method + " " + step.data.request_url
|
|
126
126
|
|
|
127
127
|
if step.data.request_body:
|
|
128
|
-
step.
|
|
128
|
+
step.add_attachment(
|
|
129
129
|
Attachment(file_name='request_body.txt', content=step.data.request_body, mime_type='text/plain',
|
|
130
130
|
temporary=True))
|
|
131
131
|
if step.data.request_headers:
|
|
132
|
-
step.
|
|
132
|
+
step.add_attachment(
|
|
133
133
|
Attachment(file_name='request_headers.txt', content=step.data.request_headers,
|
|
134
134
|
mime_type='text/plain', temporary=True))
|
|
135
135
|
if step.data.response_body:
|
|
136
|
-
step.
|
|
137
|
-
|
|
136
|
+
step.add_attachment(Attachment(file_name='response_body.txt', content=step.data.response_body,
|
|
137
|
+
mime_type='text/plain', temporary=True))
|
|
138
138
|
if step.data.response_headers:
|
|
139
|
-
step.
|
|
139
|
+
step.add_attachment(
|
|
140
140
|
Attachment(file_name='response_headers.txt', content=step.data.response_headers,
|
|
141
141
|
mime_type='text/plain', temporary=True))
|
|
142
142
|
|
|
@@ -149,9 +149,9 @@ class ApiV2Client(ApiV1Client):
|
|
|
149
149
|
if step.step_type == StepType.SLEEP:
|
|
150
150
|
prepared_step['data']['action'] = f"Sleep for {step.data.duration} seconds"
|
|
151
151
|
|
|
152
|
-
if step.attachments:
|
|
152
|
+
if step.execution.attachments:
|
|
153
153
|
uploaded_attachments = []
|
|
154
|
-
for file in step.attachments:
|
|
154
|
+
for file in step.execution.attachments:
|
|
155
155
|
attach_id = self._upload_attachment(project_code, file)
|
|
156
156
|
if attach_id:
|
|
157
157
|
uploaded_attachments.extend(attach_id)
|
|
@@ -53,7 +53,7 @@ class ConfigManager:
|
|
|
53
53
|
if config.get("profilers"):
|
|
54
54
|
self.config.set_profilers(config.get("profilers"))
|
|
55
55
|
|
|
56
|
-
if config.get("debug"):
|
|
56
|
+
if config.get("debug") is not None:
|
|
57
57
|
self.config.set_debug(
|
|
58
58
|
config.get("debug")
|
|
59
59
|
)
|
|
@@ -78,7 +78,7 @@ class ConfigManager:
|
|
|
78
78
|
if testops.get("project"):
|
|
79
79
|
self.config.testops.set_project(testops.get("project"))
|
|
80
80
|
|
|
81
|
-
if testops.get("defect"):
|
|
81
|
+
if testops.get("defect") is not None:
|
|
82
82
|
self.config.testops.set_defect(
|
|
83
83
|
testops.get("defect")
|
|
84
84
|
)
|
|
@@ -101,7 +101,7 @@ class ConfigManager:
|
|
|
101
101
|
if run.get("description"):
|
|
102
102
|
self.config.testops.run.set_description(run.get("description"))
|
|
103
103
|
|
|
104
|
-
if run.get("complete"):
|
|
104
|
+
if run.get("complete") is not None:
|
|
105
105
|
self.config.testops.run.set_complete(
|
|
106
106
|
run.get("complete")
|
|
107
107
|
)
|
|
@@ -135,7 +135,7 @@ class ConfigManager:
|
|
|
135
135
|
if framework.get("pytest"):
|
|
136
136
|
pytest = framework.get("pytest")
|
|
137
137
|
|
|
138
|
-
if pytest.get("captureLogs"):
|
|
138
|
+
if pytest.get("captureLogs") is not None:
|
|
139
139
|
self.config.framework.pytest.set_capture_logs(
|
|
140
140
|
pytest.get("captureLogs")
|
|
141
141
|
)
|
|
@@ -24,7 +24,12 @@ class Logger:
|
|
|
24
24
|
def log(self, message: str, level: str = 'info'):
|
|
25
25
|
time_str = self._get_timestamp("%H:%M:%S")
|
|
26
26
|
log = f"[Qase][{time_str}][{level}] {message}\n"
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
try:
|
|
29
|
+
print(log, end='')
|
|
30
|
+
except (OSError, IOError):
|
|
31
|
+
pass
|
|
32
|
+
|
|
28
33
|
if self.debug:
|
|
29
34
|
with self.lock:
|
|
30
35
|
with open(Logger._log_file, 'a', encoding='utf-8') as f:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
from enum import Enum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BaseModel:
|
|
7
|
+
def __str__(self, enum_as_name=False) -> str:
|
|
8
|
+
def serialize(o):
|
|
9
|
+
if isinstance(o, Enum):
|
|
10
|
+
return o.name if enum_as_name else o.value
|
|
11
|
+
elif hasattr(o, '__dict__'):
|
|
12
|
+
return o.__dict__
|
|
13
|
+
else:
|
|
14
|
+
return str(o)
|
|
15
|
+
|
|
16
|
+
return json.dumps(self, default=serialize, indent=4, sort_keys=True)
|
|
@@ -69,7 +69,6 @@ class Result(BaseModel):
|
|
|
69
69
|
self.id: str = str(uuid.uuid4())
|
|
70
70
|
self.title: str = title
|
|
71
71
|
self.signature: str = signature
|
|
72
|
-
self.run_id: Optional[str] = None
|
|
73
72
|
self.testops_ids: Optional[List[int]] = None
|
|
74
73
|
self.execution: Type[Execution] = Execution()
|
|
75
74
|
self.fields: Dict[Type[Field]] = {}
|
|
@@ -77,11 +76,9 @@ class Result(BaseModel):
|
|
|
77
76
|
self.steps: List[Type[Step]] = []
|
|
78
77
|
self.params: Optional[dict] = {}
|
|
79
78
|
self.param_groups: Optional[List[List[str]]] = []
|
|
80
|
-
self.author: Optional[str] = None
|
|
81
79
|
self.relations: Type[Relation] = None
|
|
82
80
|
self.muted: bool = False
|
|
83
81
|
self.message: Optional[str] = None
|
|
84
|
-
QaseUtils.get_host_data()
|
|
85
82
|
|
|
86
83
|
def add_message(self, message: str) -> None:
|
|
87
84
|
self.message = message
|
|
@@ -123,6 +120,3 @@ class Result(BaseModel):
|
|
|
123
120
|
|
|
124
121
|
def get_duration(self) -> int:
|
|
125
122
|
return self.execution.duration
|
|
126
|
-
|
|
127
|
-
def set_run_id(self, run_id: str) -> None:
|
|
128
|
-
self.run_id = run_id
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import json
|
|
2
|
-
|
|
3
1
|
from typing import Optional, List
|
|
4
2
|
|
|
5
3
|
from .basemodel import BaseModel
|
|
@@ -71,6 +69,7 @@ class Run(BaseModel):
|
|
|
71
69
|
"duration": result["execution"]["duration"],
|
|
72
70
|
"thread": result["execution"]["thread"]
|
|
73
71
|
}
|
|
72
|
+
self._extract_path_from_relations(result)
|
|
74
73
|
self.results.append(compact_result)
|
|
75
74
|
self.execution.track(result)
|
|
76
75
|
self.stats.track(result)
|
|
@@ -79,3 +78,16 @@ class Run(BaseModel):
|
|
|
79
78
|
|
|
80
79
|
def add_host_data(self, host_data: dict):
|
|
81
80
|
self.host_data = host_data
|
|
81
|
+
|
|
82
|
+
def _extract_path_from_relations(self, relations_dict):
|
|
83
|
+
|
|
84
|
+
titles = []
|
|
85
|
+
if "relations" in relations_dict and "suite" in relations_dict["relations"]:
|
|
86
|
+
if "data" in relations_dict["relations"]["suite"]:
|
|
87
|
+
data_list = relations_dict["relations"]["suite"]["data"]
|
|
88
|
+
titles = [item["title"] for item in data_list if "title" in item]
|
|
89
|
+
|
|
90
|
+
path = "/".join(titles)
|
|
91
|
+
|
|
92
|
+
if path and path not in self.suites:
|
|
93
|
+
self.suites.append(path)
|
|
@@ -20,6 +20,7 @@ class StepTextData(BaseModel):
|
|
|
20
20
|
def __init__(self, action: str, expected_result: Optional[str] = None):
|
|
21
21
|
self.action = action
|
|
22
22
|
self.expected_result = expected_result
|
|
23
|
+
self.input_data = None
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class StepAssertData(BaseModel):
|
|
@@ -78,6 +79,7 @@ class StepExecution(BaseModel):
|
|
|
78
79
|
self.status = status
|
|
79
80
|
self.end_time = end_time
|
|
80
81
|
self.duration = duration
|
|
82
|
+
self.attachments = []
|
|
81
83
|
|
|
82
84
|
def set_status(self, status: Optional[str]):
|
|
83
85
|
if status in ['passed', 'failed', 'skipped', 'blocked', 'untested']:
|
|
@@ -89,6 +91,9 @@ class StepExecution(BaseModel):
|
|
|
89
91
|
self.end_time = time.time()
|
|
90
92
|
self.duration = int((self.end_time - self.start_time) * 1000)
|
|
91
93
|
|
|
94
|
+
def add_attachment(self, attachment: Attachment):
|
|
95
|
+
self.attachments.append(attachment)
|
|
96
|
+
|
|
92
97
|
|
|
93
98
|
class Step(BaseModel):
|
|
94
99
|
def __init__(self,
|
|
@@ -107,7 +112,6 @@ class Step(BaseModel):
|
|
|
107
112
|
self.data = data
|
|
108
113
|
self.parent_id = parent_id
|
|
109
114
|
self.execution = StepExecution()
|
|
110
|
-
self.attachments = []
|
|
111
115
|
self.steps = []
|
|
112
116
|
|
|
113
117
|
def set_parent_id(self, parent_id: Optional[str]):
|
|
@@ -132,4 +136,4 @@ class Step(BaseModel):
|
|
|
132
136
|
self.steps = steps
|
|
133
137
|
|
|
134
138
|
def add_attachment(self, attachment: Attachment):
|
|
135
|
-
self.
|
|
139
|
+
self.execution.add_attachment(attachment)
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/report.py
RENAMED
|
@@ -41,7 +41,6 @@ class QaseReport:
|
|
|
41
41
|
pass
|
|
42
42
|
|
|
43
43
|
def add_result(self, result: Result):
|
|
44
|
-
result.set_run_id(self.run_id)
|
|
45
44
|
for attachment in result.attachments:
|
|
46
45
|
self._persist_attachment(attachment)
|
|
47
46
|
|
|
@@ -84,8 +83,8 @@ class QaseReport:
|
|
|
84
83
|
|
|
85
84
|
def _persist_attachments_in_steps(self, steps: list):
|
|
86
85
|
for step in steps:
|
|
87
|
-
if step.attachments:
|
|
88
|
-
for attachment in step.attachments:
|
|
86
|
+
if step.execution.attachments:
|
|
87
|
+
for attachment in step.execution.attachments:
|
|
89
88
|
self._persist_attachment(attachment)
|
|
90
89
|
if step.steps:
|
|
91
90
|
self._persist_attachments_in_steps(step.steps)
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/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: 3.4.
|
|
3
|
+
Version: 3.4.2
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/api_v1_client.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/client/base_api_client.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/exceptions/reporter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/attachment.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/api.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/batch.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/connection.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/framework.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/plan.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/qaseconfig.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/report.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/run.py
RENAMED
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/models/config/testops.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/profilers/network.py
RENAMED
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase/commons/reporters/testops.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{qase_python_commons-3.4.0 → qase_python_commons-3.4.2}/src/qase_python_commons.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|