qase-python-commons 3.2.7__py3-none-any.whl → 3.3.0__py3-none-any.whl
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/commons/client/api_v1_client.py +2 -2
- qase/commons/client/api_v2_client.py +2 -3
- qase/commons/models/__init__.py +3 -2
- qase/commons/models/result.py +86 -0
- qase/commons/reporters/core.py +17 -5
- qase/commons/reporters/report.py +3 -3
- qase/commons/reporters/testops.py +2 -2
- {qase_python_commons-3.2.7.dist-info → qase_python_commons-3.3.0.dist-info}/METADATA +1 -1
- {qase_python_commons-3.2.7.dist-info → qase_python_commons-3.3.0.dist-info}/RECORD +11 -11
- {qase_python_commons-3.2.7.dist-info → qase_python_commons-3.3.0.dist-info}/WHEEL +1 -1
- {qase_python_commons-3.2.7.dist-info → qase_python_commons-3.3.0.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,7 @@ from qase.api_client_v1.configuration import Configuration
|
|
|
7
7
|
from .. import Logger
|
|
8
8
|
from .base_api_client import BaseApiClient
|
|
9
9
|
from ..exceptions.reporter import ReporterException
|
|
10
|
-
from ..models import Attachment,
|
|
10
|
+
from ..models import Attachment, InternalResult, Step
|
|
11
11
|
from ..models.config.framework import Video, Trace
|
|
12
12
|
from ..models.config.qaseconfig import QaseConfig
|
|
13
13
|
from ..models.step import StepType
|
|
@@ -134,7 +134,7 @@ class ApiV1Client(BaseApiClient):
|
|
|
134
134
|
)
|
|
135
135
|
self.logger.log_debug(f"Results for run {run_id} sent successfully")
|
|
136
136
|
|
|
137
|
-
def _prepare_result(self, project_code: str, result:
|
|
137
|
+
def _prepare_result(self, project_code: str, result: InternalResult) -> Dict:
|
|
138
138
|
attached = []
|
|
139
139
|
if result.attachments:
|
|
140
140
|
for attachment in result.attachments:
|
|
@@ -17,7 +17,7 @@ from .api_v1_client import ApiV1Client
|
|
|
17
17
|
from .. import Logger
|
|
18
18
|
from ..exceptions.reporter import ReporterException
|
|
19
19
|
from ..models.config.framework import Video, Trace
|
|
20
|
-
from ..models import Attachment,
|
|
20
|
+
from ..models import Attachment, InternalResult
|
|
21
21
|
from ..models.config.qaseconfig import QaseConfig
|
|
22
22
|
from ..models.step import StepType, Step
|
|
23
23
|
|
|
@@ -53,7 +53,7 @@ class ApiV2Client(ApiV1Client):
|
|
|
53
53
|
create_results_request_v2=CreateResultsRequestV2(results=results_to_send))
|
|
54
54
|
self.logger.log_debug(f"Results for run {run_id} sent successfully")
|
|
55
55
|
|
|
56
|
-
def _prepare_result(self, project_code: str, result:
|
|
56
|
+
def _prepare_result(self, project_code: str, result: InternalResult) -> ResultCreate:
|
|
57
57
|
attached = []
|
|
58
58
|
if result.attachments:
|
|
59
59
|
for attachment in result.attachments:
|
|
@@ -85,7 +85,6 @@ class ApiV2Client(ApiV1Client):
|
|
|
85
85
|
steps_type=ResultStepsType.CLASSIC,
|
|
86
86
|
params=result.params,
|
|
87
87
|
param_groups=result.param_groups,
|
|
88
|
-
muted=False,
|
|
89
88
|
message=result.message,
|
|
90
89
|
defect=self.config.testops.defect,
|
|
91
90
|
)
|
qase/commons/models/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from .result import Result, Field
|
|
1
|
+
from .result import Result, InternalResult, Field
|
|
2
2
|
from .run import Run
|
|
3
3
|
from .attachment import Attachment
|
|
4
4
|
from .relation import Relation
|
|
@@ -12,5 +12,6 @@ __all__ = [
|
|
|
12
12
|
Relation,
|
|
13
13
|
Step,
|
|
14
14
|
Runtime,
|
|
15
|
-
Field
|
|
15
|
+
Field,
|
|
16
|
+
InternalResult
|
|
16
17
|
]
|
qase/commons/models/result.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import copy
|
|
1
2
|
import time
|
|
2
3
|
import uuid
|
|
3
4
|
|
|
@@ -65,6 +66,70 @@ class Request(BaseModel):
|
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
class Result(BaseModel):
|
|
69
|
+
def __init__(self, title: str, signature: str) -> None:
|
|
70
|
+
self.id: str = str(uuid.uuid4())
|
|
71
|
+
self.title: str = title
|
|
72
|
+
self.signature: str = signature
|
|
73
|
+
self.run_id: Optional[str] = None
|
|
74
|
+
self.testops_id: Optional[List[int]] = None
|
|
75
|
+
self.execution: Type[Execution] = Execution()
|
|
76
|
+
self.fields: Dict[Type[Field]] = {}
|
|
77
|
+
self.attachments: List[Attachment] = []
|
|
78
|
+
self.steps: List[Type[Step]] = []
|
|
79
|
+
self.params: Optional[dict] = {}
|
|
80
|
+
self.param_groups: Optional[List[List[str]]] = []
|
|
81
|
+
self.author: Optional[str] = None
|
|
82
|
+
self.relations: Type[Relation] = None
|
|
83
|
+
self.muted: bool = False
|
|
84
|
+
self.message: Optional[str] = None
|
|
85
|
+
QaseUtils.get_host_data()
|
|
86
|
+
|
|
87
|
+
def add_message(self, message: str) -> None:
|
|
88
|
+
self.message = message
|
|
89
|
+
|
|
90
|
+
def add_field(self, field: Type[Field]) -> None:
|
|
91
|
+
self.fields[field.name] = field.value
|
|
92
|
+
|
|
93
|
+
def add_steps(self, steps: List[Type[Step]]) -> None:
|
|
94
|
+
self.steps = QaseUtils().build_tree(steps)
|
|
95
|
+
|
|
96
|
+
def add_attachment(self, attachment: Attachment) -> None:
|
|
97
|
+
self.attachments.append(attachment)
|
|
98
|
+
|
|
99
|
+
def add_param(self, key: str, value: str) -> None:
|
|
100
|
+
self.params[key] = value
|
|
101
|
+
|
|
102
|
+
def add_param_groups(self, values: List[str]) -> None:
|
|
103
|
+
self.param_groups.append(values)
|
|
104
|
+
|
|
105
|
+
def set_relation(self, relation: Relation) -> None:
|
|
106
|
+
self.relations = relation
|
|
107
|
+
|
|
108
|
+
def get_status(self) -> Optional[str]:
|
|
109
|
+
return self.execution.status
|
|
110
|
+
|
|
111
|
+
def get_id(self) -> str:
|
|
112
|
+
return self.id
|
|
113
|
+
|
|
114
|
+
def get_title(self) -> str:
|
|
115
|
+
return self.title
|
|
116
|
+
|
|
117
|
+
def get_field(self, name: str) -> Optional[Type[Field]]:
|
|
118
|
+
if name in self.fields:
|
|
119
|
+
return self.fields[name]
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
def get_testops_id(self) -> Optional[List[int]]:
|
|
123
|
+
return self.testops_id
|
|
124
|
+
|
|
125
|
+
def get_duration(self) -> int:
|
|
126
|
+
return self.execution.duration
|
|
127
|
+
|
|
128
|
+
def set_run_id(self, run_id: str) -> None:
|
|
129
|
+
self.run_id = run_id
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class InternalResult(BaseModel):
|
|
68
133
|
def __init__(self, title: str, signature: str) -> None:
|
|
69
134
|
self.id: str = str(uuid.uuid4())
|
|
70
135
|
self.title: str = title
|
|
@@ -126,3 +191,24 @@ class Result(BaseModel):
|
|
|
126
191
|
|
|
127
192
|
def set_run_id(self, run_id: str) -> None:
|
|
128
193
|
self.run_id = run_id
|
|
194
|
+
|
|
195
|
+
@classmethod
|
|
196
|
+
def convert_from_result(cls, result: Result, testops_id: Optional[int] = None):
|
|
197
|
+
int_result = cls(result.title, result.signature)
|
|
198
|
+
|
|
199
|
+
int_result.id = result.id
|
|
200
|
+
int_result.title = result.title
|
|
201
|
+
int_result.signature = result.signature
|
|
202
|
+
int_result.run_id = result.run_id
|
|
203
|
+
int_result.testops_id = testops_id
|
|
204
|
+
int_result.execution = copy.deepcopy(result.execution)
|
|
205
|
+
int_result.fields = result.fields
|
|
206
|
+
int_result.attachments = result.attachments
|
|
207
|
+
int_result.steps = result.steps
|
|
208
|
+
int_result.params = result.params
|
|
209
|
+
int_result.author = result.author
|
|
210
|
+
int_result.relations = result.relations
|
|
211
|
+
int_result.muted = result.muted
|
|
212
|
+
int_result.message = result.message
|
|
213
|
+
|
|
214
|
+
return int_result
|
qase/commons/reporters/core.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import json
|
|
3
1
|
import time
|
|
4
2
|
|
|
5
3
|
from ..config import ConfigManager
|
|
@@ -8,7 +6,7 @@ from ..logger import Logger
|
|
|
8
6
|
from .report import QaseReport
|
|
9
7
|
from .testops import QaseTestOps
|
|
10
8
|
|
|
11
|
-
from ..models import Result, Attachment, Runtime
|
|
9
|
+
from ..models import InternalResult, Result, Attachment, Runtime
|
|
12
10
|
from ..models.config.qaseconfig import Mode
|
|
13
11
|
from typing import Union, List
|
|
14
12
|
|
|
@@ -81,7 +79,21 @@ class QaseCoreReporter:
|
|
|
81
79
|
try:
|
|
82
80
|
ts = time.time()
|
|
83
81
|
self.logger.log_debug(f"Adding result {result}")
|
|
84
|
-
|
|
82
|
+
ids = result.get_testops_id()
|
|
83
|
+
|
|
84
|
+
if ids is None:
|
|
85
|
+
int_result = InternalResult.convert_from_result(result)
|
|
86
|
+
self.reporter.add_result(int_result)
|
|
87
|
+
else:
|
|
88
|
+
first = True
|
|
89
|
+
for testops_id in ids:
|
|
90
|
+
int_result = InternalResult.convert_from_result(result, testops_id)
|
|
91
|
+
if not first:
|
|
92
|
+
int_result.execution.duration = 0
|
|
93
|
+
else:
|
|
94
|
+
first = False
|
|
95
|
+
self.reporter.add_result(int_result)
|
|
96
|
+
|
|
85
97
|
self.logger.log_debug(f"Result {result.get_title()} added")
|
|
86
98
|
self.overhead += time.time() - ts
|
|
87
99
|
except Exception as e:
|
|
@@ -180,7 +192,7 @@ class QaseCoreReporter:
|
|
|
180
192
|
host=self.config.testops.api.host
|
|
181
193
|
)
|
|
182
194
|
self._execution_plan = loader.load(self.config.testops.project,
|
|
183
|
-
|
|
195
|
+
int(self.config.testops.plan.id))
|
|
184
196
|
except Exception as e:
|
|
185
197
|
self.logger.log('Failed to load test plan from Qase TestOps', 'info')
|
|
186
198
|
self.logger.log(e, 'error')
|
qase/commons/reporters/report.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import shutil
|
|
4
4
|
import json
|
|
5
5
|
import re
|
|
6
|
-
from ..models import
|
|
6
|
+
from ..models import InternalResult, Run, Attachment
|
|
7
7
|
from .. import QaseUtils, Logger
|
|
8
8
|
from ..models.config.connection import Format
|
|
9
9
|
from ..models.config.qaseconfig import QaseConfig
|
|
@@ -40,7 +40,7 @@ class QaseReport:
|
|
|
40
40
|
def complete_worker(self):
|
|
41
41
|
pass
|
|
42
42
|
|
|
43
|
-
def add_result(self, result:
|
|
43
|
+
def add_result(self, result: InternalResult):
|
|
44
44
|
result.set_run_id(self.run_id)
|
|
45
45
|
for attachment in result.attachments:
|
|
46
46
|
self._persist_attachment(attachment)
|
|
@@ -91,7 +91,7 @@ class QaseReport:
|
|
|
91
91
|
self._persist_attachments_in_steps(step.steps)
|
|
92
92
|
|
|
93
93
|
# Method saves result to a file
|
|
94
|
-
def _store_result(self, result:
|
|
94
|
+
def _store_result(self, result: InternalResult):
|
|
95
95
|
self._store_object(result, self.report_path + "/results/", result.id)
|
|
96
96
|
|
|
97
97
|
def _check_report_path(self):
|
|
@@ -6,7 +6,7 @@ from typing import List
|
|
|
6
6
|
from .. import Logger, ReporterException
|
|
7
7
|
from ..client.api_v1_client import ApiV1Client
|
|
8
8
|
from ..client.base_api_client import BaseApiClient
|
|
9
|
-
from ..models import
|
|
9
|
+
from ..models import InternalResult
|
|
10
10
|
from ..models.config.qaseconfig import QaseConfig
|
|
11
11
|
|
|
12
12
|
DEFAULT_BATCH_SIZE = 200
|
|
@@ -129,7 +129,7 @@ class QaseTestOps:
|
|
|
129
129
|
if len(self.results) > 0:
|
|
130
130
|
self._send_results()
|
|
131
131
|
|
|
132
|
-
def add_result(self, result:
|
|
132
|
+
def add_result(self, result: InternalResult) -> None:
|
|
133
133
|
if result.get_status() == 'failed':
|
|
134
134
|
self.__show_link(result.testops_id, result.title)
|
|
135
135
|
self.results.append(result)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: qase-python-commons
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
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
|
|
@@ -3,15 +3,15 @@ qase/commons/config.py,sha256=dtF8JPHeGe4SxpR36WbvzX76yP-0nP43NpCf6sh9d-I,9245
|
|
|
3
3
|
qase/commons/loader.py,sha256=-MMY4HgSI6q1xq3NaJoq_w4liM73qdFKjYLVCT1E7Pc,1064
|
|
4
4
|
qase/commons/logger.py,sha256=K_8kE0EqpFbF2RbRU5TBw4Hl6GfK6PacpwkRXqHabl0,1234
|
|
5
5
|
qase/commons/utils.py,sha256=OOr6kQ5hPZEyHXwbwiTOTkonRxmmtkyZPPGqXQKp5vY,2799
|
|
6
|
-
qase/commons/client/api_v1_client.py,sha256=
|
|
7
|
-
qase/commons/client/api_v2_client.py,sha256=
|
|
6
|
+
qase/commons/client/api_v1_client.py,sha256=FiCvFQZEGVidmR-AaDyF2er3EbCoHj9JCmYcm7LhYoc,12731
|
|
7
|
+
qase/commons/client/api_v2_client.py,sha256=afA-BfOA8Z4yM58H8NMEm-naOErOSt_UkGAke1yRxcY,8298
|
|
8
8
|
qase/commons/client/base_api_client.py,sha256=H8JnjqSrBFNfghDd3T3zxYOyKYHYe9QiJQXol1JqdQk,2613
|
|
9
9
|
qase/commons/exceptions/reporter.py,sha256=dP-Mwcq8HKBOjgu3YqhyULDmDGU09BmT6Fh9HjICaUc,45
|
|
10
|
-
qase/commons/models/__init__.py,sha256=
|
|
10
|
+
qase/commons/models/__init__.py,sha256=9RH4aKBEvE6vHLcb_o_ngn2jNfGfcwpQ4u7ABEis85k,308
|
|
11
11
|
qase/commons/models/attachment.py,sha256=Rjq1mAP11uk7TN2RrtImntw6DUMV7U0R-44TYj8O5j0,1432
|
|
12
12
|
qase/commons/models/basemodel.py,sha256=nyDSXhpQUecKdzhB-eWqujmso20oXB9p_42qpOsGVuQ,213
|
|
13
13
|
qase/commons/models/relation.py,sha256=HymHeh1uBcoQnTs4Vra7WJ_KFkhryj5o7cShjoGQImI,511
|
|
14
|
-
qase/commons/models/result.py,sha256=
|
|
14
|
+
qase/commons/models/result.py,sha256=59uEHgobscRiXJW8KoNoKyfHXnlj8S1zezoh4Gy3joQ,6819
|
|
15
15
|
qase/commons/models/run.py,sha256=KkplvlHJNvVLORzVkdz5mHsLFBTUAdtuEYCqCy_RcvU,2469
|
|
16
16
|
qase/commons/models/runtime.py,sha256=mfK-mOViD1orXOx-jP6nIgtnN0tUmRYY1aMH0qFDmXA,1287
|
|
17
17
|
qase/commons/models/step.py,sha256=M-btRYZ4febYavDhwFqmKcCdLAgrhtuv7E_M3TKZdfg,4281
|
|
@@ -29,11 +29,11 @@ qase/commons/profilers/db.py,sha256=Am1tvvLgJq4_A8JsuSeBGf47BD2lnSX-5KiMjSgr-Ko,
|
|
|
29
29
|
qase/commons/profilers/network.py,sha256=zKNBnTQG4BMg8dn8O--tQzQLpu-qs5ADhHEnqIas0gM,4950
|
|
30
30
|
qase/commons/profilers/sleep.py,sha256=HT6h0R-2XHZAoBYRxS2T_KC8RrnEoVjP7MXusaE4Nec,1624
|
|
31
31
|
qase/commons/reporters/__init__.py,sha256=J0aNLzb_MPPT_zF8BtX_w9nj_U7Ad06RGpyWK5Pxq1o,169
|
|
32
|
-
qase/commons/reporters/core.py,sha256=
|
|
33
|
-
qase/commons/reporters/report.py,sha256=
|
|
34
|
-
qase/commons/reporters/testops.py,sha256=
|
|
32
|
+
qase/commons/reporters/core.py,sha256=eLn24JWPK6MoqGonPx7YnjVtpK1gSLM379Fmlxea3LE,8603
|
|
33
|
+
qase/commons/reporters/report.py,sha256=50PDOBZJZA3_Z45bggBtkNfntycUkO9RaGYnzjdy8uA,4853
|
|
34
|
+
qase/commons/reporters/testops.py,sha256=9GOXHTmuAX-kglXINyi4z0ul01IqaYQmJtTX-S2A2ek,6280
|
|
35
35
|
qase/commons/validators/base.py,sha256=wwSn-4YiuXtfGMGnSKgo9Vm5hAKevVmmfd2Ro6Q7MYQ,173
|
|
36
|
-
qase_python_commons-3.
|
|
37
|
-
qase_python_commons-3.
|
|
38
|
-
qase_python_commons-3.
|
|
39
|
-
qase_python_commons-3.
|
|
36
|
+
qase_python_commons-3.3.0.dist-info/METADATA,sha256=jfwvrB4LAPlIvYvNo3ogp87fJf8dopIpZ0x_bAqXV3M,1857
|
|
37
|
+
qase_python_commons-3.3.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
38
|
+
qase_python_commons-3.3.0.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
|
|
39
|
+
qase_python_commons-3.3.0.dist-info/RECORD,,
|
|
File without changes
|