qase-python-commons 3.4.0__tar.gz → 3.4.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.

Files changed (47) hide show
  1. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/PKG-INFO +1 -1
  2. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/pyproject.toml +1 -1
  3. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/client/api_v2_client.py +7 -7
  4. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/logger.py +6 -1
  5. qase_python_commons-3.4.1/src/qase/commons/models/basemodel.py +16 -0
  6. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/result.py +0 -6
  7. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/run.py +14 -2
  8. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/step.py +6 -2
  9. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/reporters/report.py +2 -3
  10. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase_python_commons.egg-info/PKG-INFO +1 -1
  11. qase_python_commons-3.4.0/src/qase/commons/models/basemodel.py +0 -7
  12. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/README.md +0 -0
  13. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/setup.cfg +0 -0
  14. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/__init__.py +0 -0
  15. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/client/api_v1_client.py +0 -0
  16. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/client/base_api_client.py +0 -0
  17. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/config.py +0 -0
  18. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/exceptions/reporter.py +0 -0
  19. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/loader.py +0 -0
  20. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/__init__.py +0 -0
  21. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/attachment.py +0 -0
  22. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/api.py +0 -0
  23. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/batch.py +0 -0
  24. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/connection.py +0 -0
  25. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/framework.py +0 -0
  26. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/plan.py +0 -0
  27. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/qaseconfig.py +0 -0
  28. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/report.py +0 -0
  29. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/run.py +0 -0
  30. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/config/testops.py +0 -0
  31. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/relation.py +0 -0
  32. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/models/runtime.py +0 -0
  33. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/profilers/__init__.py +0 -0
  34. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/profilers/db.py +0 -0
  35. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/profilers/network.py +0 -0
  36. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/profilers/sleep.py +0 -0
  37. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/reporters/__init__.py +0 -0
  38. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/reporters/core.py +0 -0
  39. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/reporters/testops.py +0 -0
  40. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/util/__init__.py +0 -0
  41. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/util/host_data.py +0 -0
  42. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/utils.py +0 -0
  43. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase/commons/validators/base.py +0 -0
  44. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase_python_commons.egg-info/SOURCES.txt +0 -0
  45. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase_python_commons.egg-info/dependency_links.txt +0 -0
  46. {qase_python_commons-3.4.0 → qase_python_commons-3.4.1}/src/qase_python_commons.egg-info/requires.txt +0 -0
  47. {qase_python_commons-3.4.0 → qase_python_commons-3.4.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: 3.4.0
3
+ Version: 3.4.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qase-python-commons"
7
- version = "3.4.0"
7
+ version = "3.4.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"}]
@@ -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.attachments.append(
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.attachments.append(
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.attachments.append(Attachment(file_name='response_body.txt', content=step.data.response_body,
137
- mime_type='text/plain', temporary=True))
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.attachments.append(
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)
@@ -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
- print(log)
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.attachments.append(attachment)
139
+ self.execution.add_attachment(attachment)
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qase-python-commons
3
- Version: 3.4.0
3
+ Version: 3.4.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
@@ -1,7 +0,0 @@
1
- import json
2
-
3
-
4
- class BaseModel:
5
- def __str__(self) -> str:
6
- return json.dumps(self, default=lambda o: o.__dict__ if hasattr(o, '__dict__') else str(o), indent=4,
7
- sort_keys=True)