qase-python-commons 3.1.3__py3-none-any.whl → 3.1.5__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.

@@ -2,7 +2,7 @@ from typing import Dict, Union
2
2
 
3
3
  import certifi
4
4
  from qase.api_client_v1 import ApiClient, ProjectsApi, Project, EnvironmentsApi, RunsApi, AttachmentsApi, \
5
- AttachmentGet, RunCreate, ResultsApi, ResultcreateBulk
5
+ AttachmentGet, RunCreate, ResultsApi, ResultcreateBulk, AuthorsApi
6
6
  from qase.api_client_v1.configuration import Configuration
7
7
  from .. import Logger
8
8
  from .base_api_client import BaseApiClient
@@ -16,6 +16,7 @@ class ApiV1Client(BaseApiClient):
16
16
  def __init__(self, config: QaseConfig, logger: Logger):
17
17
  self.logger = logger
18
18
  self.config = config
19
+ self.__authors = {}
19
20
 
20
21
  try:
21
22
  self.logger.log_debug("Preparing API client")
@@ -198,6 +199,11 @@ class ApiV1Client(BaseApiClient):
198
199
  if test_ops_id:
199
200
  result_model["case_id"] = test_ops_id
200
201
 
202
+ if result.get_field('author'):
203
+ author_id = self._get_author_id(result.get_field('author'))
204
+ if author_id:
205
+ result_model["author_id"] = author_id
206
+
201
207
  self.logger.log_debug(f"Prepared result: {result_model}")
202
208
 
203
209
  return result_model
@@ -257,3 +263,16 @@ class ApiV1Client(BaseApiClient):
257
263
  except Exception as e:
258
264
  self.logger.log(f"Error at preparing step: {e}", "error")
259
265
  raise ReporterException(e)
266
+
267
+ def _get_author_id(self, author: str) -> Union[str, None]:
268
+ if author in self.__authors:
269
+ return self.__authors[author]
270
+
271
+ author_api = AuthorsApi(self.client)
272
+ authors = author_api.get_authors(search=author)
273
+ if authors.result.total == 0:
274
+ return None
275
+
276
+ self.__authors[author] = authors.result.entities[0].author_id
277
+
278
+ return authors.result.entities[0].author_id
@@ -1,4 +1,4 @@
1
- from .step import Step, StepTextData
1
+ from .step import Step
2
2
  from .attachment import Attachment
3
3
 
4
4
 
@@ -41,3 +41,8 @@ class Runtime:
41
41
  self.result.add_attachment(attachment)
42
42
  except Exception as e:
43
43
  raise QaseRuntimeException(e)
44
+
45
+ def clear(self):
46
+ self.result = None
47
+ self.steps = {}
48
+ self.step_id = None
@@ -1,4 +1,5 @@
1
1
  import sys
2
+ import threading
2
3
  import uuid
3
4
  from functools import wraps
4
5
  from ..models.runtime import Runtime
@@ -108,11 +109,14 @@ class NetworkProfiler:
108
109
 
109
110
  class NetworkProfilerSingleton:
110
111
  _instance = None
112
+ _lock = threading.Lock()
111
113
 
112
114
  @staticmethod
113
115
  def init(**kwargs):
114
116
  if NetworkProfilerSingleton._instance is None:
115
- NetworkProfilerSingleton._instance = NetworkProfiler(**kwargs)
117
+ with NetworkProfilerSingleton._lock:
118
+ if NetworkProfilerSingleton._instance is None:
119
+ NetworkProfilerSingleton._instance = NetworkProfiler(**kwargs)
116
120
 
117
121
  @staticmethod
118
122
  def get_instance() -> NetworkProfiler:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qase-python-commons
3
- Version: 3.1.3
3
+ Version: 3.1.5
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/master/qase-python-commons
@@ -22,7 +22,7 @@ Requires-Python: >=3.7
22
22
  Description-Content-Type: text/markdown
23
23
  Requires-Dist: certifi>=2024.2.2
24
24
  Requires-Dist: attrs>=23.2.0
25
- Requires-Dist: qase-api-client~=1.1.0
25
+ Requires-Dist: qase-api-client~=1.1.1
26
26
  Requires-Dist: qase-api-v2-client~=1.0.0
27
27
  Requires-Dist: more-itertools
28
28
  Provides-Extra: testing
@@ -3,7 +3,7 @@ qase/commons/config.py,sha256=meRRgDrsA9qQ9fZR4fnP0VdngrKiGcHF9nnJkf3eJpg,8320
3
3
  qase/commons/loader.py,sha256=-MMY4HgSI6q1xq3NaJoq_w4liM73qdFKjYLVCT1E7Pc,1064
4
4
  qase/commons/logger.py,sha256=ka5chQYBXLUB5pM4YHDBo3QCZfBTGMtC3H33tI4NbPQ,1027
5
5
  qase/commons/utils.py,sha256=OOr6kQ5hPZEyHXwbwiTOTkonRxmmtkyZPPGqXQKp5vY,2799
6
- qase/commons/client/api_v1_client.py,sha256=NVluiG_pBZL4u2D34WtgXaPkA4TdJhmHUNd6rnfcDeg,11178
6
+ qase/commons/client/api_v1_client.py,sha256=FGuuAx6eR34X71uqK2E3BmO8NibJhU03T3kQB8ST89M,11841
7
7
  qase/commons/client/api_v2_client.py,sha256=F3wU_2EKe6eUjNRahvnDmpbx99PwZB6Lxc4VPRj7w58,7247
8
8
  qase/commons/client/base_api_client.py,sha256=H8JnjqSrBFNfghDd3T3zxYOyKYHYe9QiJQXol1JqdQk,2613
9
9
  qase/commons/exceptions/reporter.py,sha256=dP-Mwcq8HKBOjgu3YqhyULDmDGU09BmT6Fh9HjICaUc,45
@@ -13,7 +13,7 @@ qase/commons/models/basemodel.py,sha256=nyDSXhpQUecKdzhB-eWqujmso20oXB9p_42qpOsG
13
13
  qase/commons/models/relation.py,sha256=Hscui14vuSdKVdPPej4V1-SF4XHvJ2Tqg0KH8d49dH0,321
14
14
  qase/commons/models/result.py,sha256=im6L5F44yXAyD6HQy8kP9fncjrKn-7HN30ZnezSdi_Q,4423
15
15
  qase/commons/models/run.py,sha256=KkplvlHJNvVLORzVkdz5mHsLFBTUAdtuEYCqCy_RcvU,2469
16
- qase/commons/models/runtime.py,sha256=1euzotexy7iVjJghg_eVaL1F7gRrB3SV8tq8IRNu0P0,1200
16
+ qase/commons/models/runtime.py,sha256=mfK-mOViD1orXOx-jP6nIgtnN0tUmRYY1aMH0qFDmXA,1287
17
17
  qase/commons/models/step.py,sha256=M-btRYZ4febYavDhwFqmKcCdLAgrhtuv7E_M3TKZdfg,4281
18
18
  qase/commons/models/suite.py,sha256=Z2tlxdeIsuzjIoPnuyVq23pt59Yt6LVmofcew5Njk_s,348
19
19
  qase/commons/models/config/api.py,sha256=IyYY2f3ncESUAEGvkE3-meatebBFJdvgo7KNOQnxLE0,288
@@ -27,14 +27,14 @@ qase/commons/models/config/run.py,sha256=QPOPq0__J5Pey2MfjnEgTuCCDYgjog-rjMJBjiM
27
27
  qase/commons/models/config/testops.py,sha256=O5aFtZHYt3Uj8wRT3Vg_U4qBFINy9Dn6lKTDamuK3QE,822
28
28
  qase/commons/profilers/__init__.py,sha256=GhKT5hRbHbhAC4GhdyChA8XoAsGQOnIb8S2Z4-fdS7Q,222
29
29
  qase/commons/profilers/db.py,sha256=Am1tvvLgJq4_A8JsuSeBGf47BD2lnSX-5KiMjSgr-Ko,391
30
- qase/commons/profilers/network.py,sha256=zxW_sErcMgHjzVGxk6Njp23YzhZrGgh7trC1r2zHHjU,4784
30
+ qase/commons/profilers/network.py,sha256=zKNBnTQG4BMg8dn8O--tQzQLpu-qs5ADhHEnqIas0gM,4950
31
31
  qase/commons/profilers/sleep.py,sha256=HT6h0R-2XHZAoBYRxS2T_KC8RrnEoVjP7MXusaE4Nec,1624
32
32
  qase/commons/reporters/__init__.py,sha256=J0aNLzb_MPPT_zF8BtX_w9nj_U7Ad06RGpyWK5Pxq1o,169
33
33
  qase/commons/reporters/core.py,sha256=0x5G-KVfEOWyXiXaX5__7JBIr3Rxy8vhy0cByUSZUc0,8021
34
34
  qase/commons/reporters/report.py,sha256=MPsFv3k2l4652NyXEGFiSmwsSpwZT3Is-lLRXvsniz4,4606
35
35
  qase/commons/reporters/testops.py,sha256=f5BcorFwIK5BSeA4Rv4IKDddkWrAXL_w-Y5Xn--NdYs,6264
36
36
  qase/commons/validators/base.py,sha256=wwSn-4YiuXtfGMGnSKgo9Vm5hAKevVmmfd2Ro6Q7MYQ,173
37
- qase_python_commons-3.1.3.dist-info/METADATA,sha256=gPr1b6ZR6Qn1Ma4VCR_wBb5htebpF_0k6DJupUOqSCc,1859
38
- qase_python_commons-3.1.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
39
- qase_python_commons-3.1.3.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
- qase_python_commons-3.1.3.dist-info/RECORD,,
37
+ qase_python_commons-3.1.5.dist-info/METADATA,sha256=JAIX-M30ouCPycPefZ39MlBx92RJbaC6SyNnD-IL9IE,1859
38
+ qase_python_commons-3.1.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
39
+ qase_python_commons-3.1.5.dist-info/top_level.txt,sha256=Mn5aFk7H7Uia4s1NRDsvebu8vCrFy9nOuRIBfkIY5kQ,5
40
+ qase_python_commons-3.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5