hardpy 0.15.1__py3-none-any.whl → 0.15.2__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.
hardpy/__init__.py CHANGED
@@ -49,6 +49,7 @@ from hardpy.pytest_hardpy.utils import (
49
49
  ComparisonOperation,
50
50
  DialogBox,
51
51
  DuplicateParameterError,
52
+ Group,
52
53
  HTMLComponent,
53
54
  ImageComponent,
54
55
  Instrument,
@@ -74,6 +75,7 @@ __all__ = [
74
75
  "DialogBox",
75
76
  "DuplicateParameterError",
76
77
  "ErrorCode",
78
+ "Group",
77
79
  "HTMLComponent",
78
80
  "ImageComponent",
79
81
  "Instrument",
@@ -148,7 +148,7 @@ class NumericMeasurement(IBaseMeasurement):
148
148
 
149
149
  model_config = ConfigDict(extra="forbid")
150
150
 
151
- type: MeasurementType = Field(default=MeasurementType.NUMERIC)
151
+ type: MeasurementType = Field(default=MeasurementType.NUMERIC, frozen=True)
152
152
  value: int | float
153
153
  name: str | None = Field(default=None)
154
154
  unit: str | None = Field(default=None)
@@ -164,7 +164,7 @@ class StringMeasurement(IBaseMeasurement):
164
164
 
165
165
  model_config = ConfigDict(extra="forbid")
166
166
 
167
- type: MeasurementType = Field(default=MeasurementType.STRING)
167
+ type: MeasurementType = Field(default=MeasurementType.STRING, frozen=True)
168
168
  value: str
169
169
  name: str | None = Field(default=None)
170
170
  casesensitive: bool = Field(default=True)
@@ -320,7 +320,7 @@ class HardpyPlugin:
320
320
  attempt = node_info.attempt
321
321
  module_id = node_info.module_id
322
322
  case_id = node_info.case_id
323
- casusd_dut_failure_id = self._reporter.get_caused_dut_failure_id()
323
+ caused_dut_failure_id = self._reporter.get_caused_dut_failure_id()
324
324
  is_dut_failure = True
325
325
 
326
326
  if node_info.critical:
@@ -334,6 +334,7 @@ class HardpyPlugin:
334
334
  self._reporter.set_module_status(module_id, TestStatus.RUN)
335
335
  self._reporter.set_case_status(module_id, case_id, TestStatus.RUN)
336
336
  self._reporter.set_case_attempt(module_id, case_id, current_attempt)
337
+ self._reporter.clear_case_data(module_id, case_id)
337
338
  self._reporter.update_db_by_doc()
338
339
 
339
340
  try:
@@ -342,6 +343,9 @@ class HardpyPlugin:
342
343
  self._is_critical_not_passed = False
343
344
  is_dut_failure = False
344
345
  self._reporter.set_case_status(module_id, case_id, TestStatus.PASSED)
346
+ # clear the error code if there were no failed tests before
347
+ if caused_dut_failure_id is None:
348
+ self._reporter.clear_error_code()
345
349
  break
346
350
  except AssertionError:
347
351
  self._reporter.set_case_status(module_id, case_id, TestStatus.FAILED)
@@ -349,7 +353,8 @@ class HardpyPlugin:
349
353
  if current_attempt == attempt:
350
354
  break
351
355
 
352
- if is_dut_failure and casusd_dut_failure_id is None:
356
+ # set the caused dut failure id only the first time
357
+ if is_dut_failure and caused_dut_failure_id is None:
353
358
  self._reporter.set_caused_dut_failure_id(module_id, case_id)
354
359
 
355
360
  # Reporting hooks
@@ -43,10 +43,17 @@ class CurrentTestInfo:
43
43
  case_id: str
44
44
 
45
45
 
46
- class ErrorCodeMeta(type):
47
- """Error code metaclass."""
46
+ class ErrorCode:
47
+ """Save error code and return error message.
48
+
49
+ It must be called from an assert.
50
+
51
+ Args:
52
+ code (int): error code.
53
+ message (str): error message.
54
+ """
48
55
 
49
- def __call__(cls, code: int, message: str | None = None) -> str | None:
56
+ def __init__(self, code: int, message: str | None = None) -> str | None:
50
57
  """Add error code to document.
51
58
 
52
59
  Args:
@@ -64,19 +71,13 @@ class ErrorCodeMeta(type):
64
71
  if reporter.get_field(key) is None:
65
72
  reporter.set_doc_value(key, code)
66
73
  reporter.update_db_by_doc()
67
- if message: # noqa: RET503
68
- return message
74
+ self._message = message
69
75
 
76
+ def __repr__(self) -> str:
77
+ return self._message
70
78
 
71
- class ErrorCode(metaclass=ErrorCodeMeta):
72
- """Save error code and return error message.
73
-
74
- It must be called from an assert.
75
-
76
- Args:
77
- code (int): error code.
78
- message (str): error message.
79
- """
79
+ def __str__(self) -> str | None:
80
+ return self._message
80
81
 
81
82
 
82
83
  def get_current_report() -> ResultRunStore | None:
@@ -261,6 +261,35 @@ class HookReporter(BaseReporter):
261
261
  key = self.generate_key(DF.CAUSED_DUT_FAILURE_ID)
262
262
  return self._statestore.get_field(key)
263
263
 
264
+ def clear_case_data(self, module_id: str, case_id: str) -> None:
265
+ """Clear test case data.
266
+
267
+ Args:
268
+ module_id (str): module id
269
+ case_id (str): case id
270
+ """
271
+ # fmt: off
272
+ key = self.generate_key(DF.MODULES, module_id, DF.CASES, case_id, DF.ARTIFACT)
273
+ self.set_doc_value(key, {})
274
+
275
+ key = self.generate_key(DF.MODULES, module_id, DF.CASES, case_id, DF.MSG)
276
+ self.set_doc_value(key, None)
277
+
278
+ key = self.generate_key(DF.MODULES, module_id, DF.CASES, case_id, DF.ASSERTION_MSG) # noqa: E501
279
+ self.set_doc_value(key, None)
280
+
281
+ key = self.generate_key(DF.MODULES, module_id, DF.CASES, case_id, DF.MEASUREMENTS) # noqa: E501
282
+ self.set_doc_value(key, [])
283
+
284
+ key = self.generate_key(DF.MODULES, module_id, DF.CASES, case_id, DF.CHART)
285
+ self.set_doc_value(key, None)
286
+ # fmt: on
287
+
288
+ def clear_error_code(self) -> None:
289
+ """Clear error code."""
290
+ key = self.generate_key(DF.ERROR_CODE)
291
+ self.set_doc_value(key, None)
292
+
264
293
  def update_node_order(self, nodes: dict) -> None:
265
294
  """Update node order.
266
295
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hardpy
3
- Version: 0.15.1
3
+ Version: 0.15.2
4
4
  Summary: HardPy library for device testing
5
5
  Project-URL: Homepage, https://github.com/everypinio/hardpy/
6
6
  Project-URL: Documentation, https://everypinio.github.io/hardpy/
@@ -1,4 +1,4 @@
1
- hardpy/__init__.py,sha256=wIDpTCST_Cod8rJ3k-ilLHGjhbF6pU3_TFZUtwcwQZM,2866
1
+ hardpy/__init__.py,sha256=GF5YV1Di7IEfXXJDg3BDto-qapcvy4Wum9dH-X78Qn8,2890
2
2
  hardpy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  hardpy/cli/cli.py,sha256=-KS8qggaCGz0Hcdd4TLJPwKpVSDfubSp5t5cWuXoMUc,9434
4
4
  hardpy/cli/template.py,sha256=44phTqeKgFch5xdAJmDQ-za1mM1_z60izRVbmCQHU-8,6225
@@ -45,8 +45,8 @@ hardpy/hardpy_panel/frontend/dist/locales/ja/translation.json,sha256=xSDe9TN1f3g
45
45
  hardpy/hardpy_panel/frontend/dist/locales/ru/translation.json,sha256=Zo_5GhOFIwOnpQITD5x2Q7CYTI9Pdpvv844_ieW56jY,2609
46
46
  hardpy/hardpy_panel/frontend/dist/locales/zh/translation.json,sha256=uxYSv8eXTMDewPvbFZSh21ZP0Wy4mx32XbbVkzXzlls,1790
47
47
  hardpy/pytest_hardpy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- hardpy/pytest_hardpy/plugin.py,sha256=2B-jNRfuY30m6i0TPjeVetR9_oGs15bnYXd_gQ2hSDI,21102
49
- hardpy/pytest_hardpy/pytest_call.py,sha256=v5ACrfxlFA9JOfwPiv2ELhiuoggE_tAgNZkuBKQzBwo,21503
48
+ hardpy/pytest_hardpy/plugin.py,sha256=1NHo2SRhJaZ6ElFUuy8qwpUM3mXqSYmG82lwJMxd9yE,21405
49
+ hardpy/pytest_hardpy/pytest_call.py,sha256=2bMDkcNyaADLocxnFS3ykYQG7bqeNWwxf_LukmcI25M,21515
50
50
  hardpy/pytest_hardpy/pytest_wrapper.py,sha256=0tG725R3qhLI6t6zi0-OL17FCwt3YI-mwrBjWe4U9A4,4694
51
51
  hardpy/pytest_hardpy/db/__init__.py,sha256=G6y13JPh8HaH2O9E3_LTH_bTUVSgiezQFjDGaNIljec,557
52
52
  hardpy/pytest_hardpy/db/base_connector.py,sha256=5a476F5LwvFUfQ4Yc0Q6biacULDrCk8UHPlpc6n0NRQ,1111
@@ -56,10 +56,10 @@ hardpy/pytest_hardpy/db/const.py,sha256=E_A0IKGeS3qyPX4fTfUE5ksARsrTKSVWqUkdmh8S
56
56
  hardpy/pytest_hardpy/db/runstore.py,sha256=tCXWo2AW0er3lbDcCqYbYxOBbINMZNtfnnjlIJpXmIA,949
57
57
  hardpy/pytest_hardpy/db/statestore.py,sha256=0sv4AqzwW_J34O-cb7aN3zmgULIVtZRi_qg4XvC2_L0,586
58
58
  hardpy/pytest_hardpy/db/schema/__init__.py,sha256=1S73W3PLQt8gX5Y33nbX1JdwLvnrtlKH4cElID3pwuc,263
59
- hardpy/pytest_hardpy/db/schema/v1.py,sha256=L-x3xunLtP3FnBRdduSP5SpqaNARwwbp1ICXy58VdcA,6238
59
+ hardpy/pytest_hardpy/db/schema/v1.py,sha256=nHqAMBJgS7eUq0yy95ymSyYGsKdIDiISMJ816iWqjwg,6264
60
60
  hardpy/pytest_hardpy/reporter/__init__.py,sha256=rztpM2HlLUpMOvad0JHbZU4Mk8PDDQyCFXLhpLktGQI,322
61
61
  hardpy/pytest_hardpy/reporter/base.py,sha256=KRkc5a7yk9ZsQ92gnBdHhJEXSSQiTWbEMSMzRMpJDFY,2915
62
- hardpy/pytest_hardpy/reporter/hook_reporter.py,sha256=vkN78UtXs5M-rmpDdxjFEwrAPOFIpSEU8TRZUdnuWJY,14619
62
+ hardpy/pytest_hardpy/reporter/hook_reporter.py,sha256=IAseKoQcZWlgS3NLYNnBOC5aGsJUgzyZLqljpd8Tfsg,15672
63
63
  hardpy/pytest_hardpy/reporter/runner_reporter.py,sha256=YsK8wrLIulsixePG6WNfC4MagpKfhP5j0CUaXkcfeL0,790
64
64
  hardpy/pytest_hardpy/result/__init__.py,sha256=2afpuEuOcxYfIEOwWzsGZe960iQaPVCmsbYujijQg1s,592
65
65
  hardpy/pytest_hardpy/result/couchdb_config.py,sha256=ujxyJYM2pdZzi3GZ2Zysbz2_ZeTRN5sQc8AGuzRJm_0,3243
@@ -79,8 +79,8 @@ hardpy/pytest_hardpy/utils/node_info.py,sha256=DaW566WvsyWR66CThuZ38UoHwQa-pu-4W
79
79
  hardpy/pytest_hardpy/utils/progress_calculator.py,sha256=TPl2gG0ZSvMe8otPythhF9hkD6fa6-mJAhy9yI83-yE,1071
80
80
  hardpy/pytest_hardpy/utils/singleton.py,sha256=tjUGs48o_vBeVpRsEBZEOTCoCUikpIFmQ1c3rsfymso,948
81
81
  hardpy/pytest_hardpy/utils/stand_type.py,sha256=p3AFtgMt-sn8QXRp60YM-xo2mEjZHUhYr_Mxhz1WyP0,7438
82
- hardpy-0.15.1.dist-info/METADATA,sha256=d22v4-7WgRCOwz7YDfQcl-F7DHA0KsmtOM0E81x77AA,4058
83
- hardpy-0.15.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- hardpy-0.15.1.dist-info/entry_points.txt,sha256=nL2sMkKMScNaOE0IPkYnu9Yr-BUswZvGSrwY-SxHY3E,102
85
- hardpy-0.15.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
86
- hardpy-0.15.1.dist-info/RECORD,,
82
+ hardpy-0.15.2.dist-info/METADATA,sha256=GBBbXqU0xCEBbO9ohWiZcC1iEBBKk_Pb9puxIE48Vyc,4058
83
+ hardpy-0.15.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ hardpy-0.15.2.dist-info/entry_points.txt,sha256=nL2sMkKMScNaOE0IPkYnu9Yr-BUswZvGSrwY-SxHY3E,102
85
+ hardpy-0.15.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
86
+ hardpy-0.15.2.dist-info/RECORD,,