pytest-regtest 2.3.5__py3-none-any.whl → 2.3.6__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.
@@ -271,7 +271,7 @@ class SnapshotPlugin:
271
271
  return SnapshotException(results)
272
272
 
273
273
  def check_snapshot(self, idx, item, snapshot):
274
- handler, obj, version, _ = snapshot
274
+ handler, obj, failure_handler, version, _ = snapshot
275
275
 
276
276
  test_folder = item.fspath.dirname
277
277
  if version is not None:
@@ -321,6 +321,14 @@ class SnapshotPlugin:
321
321
  ok = handler.compare(obj, recorded_obj)
322
322
  if ok:
323
323
  return True, True, None
324
+
325
+ if failure_handler is not None:
326
+ try:
327
+ failure_handler(obj, recorded_obj)
328
+ except Exception as e:
329
+ msg = [f"failure handler {failure_handler} raised exception {e}"]
330
+ return False, False, msg
331
+
324
332
  msg = handler.show_differences(obj, recorded_obj, has_markup)
325
333
  return True, False, msg
326
334
 
@@ -345,7 +353,7 @@ class SnapshotPlugin:
345
353
  path = item.fspath.relto(item.session.fspath)
346
354
  code_lines = item.fspath.readlines()
347
355
 
348
- for handler, obj, version, line_no in snapshots:
356
+ for handler, obj, failure_handler, version, line_no in snapshots:
349
357
  info = code_lines[line_no - 1].strip()
350
358
  tw.line(f"> {path} +{line_no}")
351
359
  tw.line(f"> {info}")
@@ -392,7 +400,7 @@ class SnapshotPlugin:
392
400
  colors.append(NO_COLOR)
393
401
 
394
402
  for ok, snapshot, is_recorded, msg in exc_args[0]:
395
- obj, version, kw, line_no = snapshot
403
+ obj, failure_handler, version, kw, line_no = snapshot
396
404
  info = code_lines[line_no - 1].strip()
397
405
 
398
406
  path = item.fspath.relto(item.session.fspath)
@@ -506,14 +514,14 @@ class Snapshot:
506
514
 
507
515
  self.snapshots = []
508
516
 
509
- def check(self, obj, *, version=None, **options):
517
+ def check(self, obj, *, failure_handler=None, version=None, **options):
510
518
  handler_class = SnapshotHandlerRegistry.get_handler(obj)
511
519
  if handler_class is None:
512
520
  raise ValueError(f"no handler registered for {obj}")
513
521
 
514
522
  handler = handler_class(options, self.request.config, tw)
515
523
  line_no = inspect.currentframe().f_back.f_lineno
516
- self.snapshots.append((handler, obj, version, line_no))
524
+ self.snapshots.append((handler, obj, failure_handler, version, line_no))
517
525
 
518
526
 
519
527
  def cleanup(output, request):
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-regtest
3
- Version: 2.3.5
3
+ Version: 2.3.6
4
4
  Summary: pytest plugin for snapshot regression testing
5
5
  Author-email: Uwe Schmitt <uwe.schmitt@id.ethz.ch>
6
6
  License-Expression: MIT
7
7
  Project-URL: Source, https://gitlab.com/uweschmitt/pytest-regtest
8
8
  Project-URL: Documentation, https://pytest-regtest.readthedocs.org
9
9
  Classifier: Intended Audience :: Developers
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
10
  Classifier: Programming Language :: Python :: 3.11
13
11
  Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
14
13
  Description-Content-Type: text/markdown
15
14
  License-File: LICENSE.txt
16
15
  Requires-Dist: pytest>7.2
@@ -2,13 +2,13 @@ pytest_regtest/__init__.py,sha256=GiURR8QAsu7GAVtbBEnwr1nNIcemLlcX7H5APQCb1ok,25
2
2
  pytest_regtest/numpy_handler.py,sha256=iuCN4fPr8ldEPeS5henmfmGg7nhFDjLMisgwotpm5rA,7157
3
3
  pytest_regtest/pandas_handler.py,sha256=iDo5i5nSAYVWlOAps3pB3cbJmRvq1gHsWBF5y8f2M2c,4446
4
4
  pytest_regtest/polars_handler.py,sha256=G25GmzZo95MzHoehvKXiv-SV8TkKA4TnLEqQ-nZa3d8,3796
5
- pytest_regtest/pytest_regtest.py,sha256=c6k2NV-yWOecf4AjGgP1k_1oNXf5XD65aqqLYmRB5R8,22897
5
+ pytest_regtest/pytest_regtest.py,sha256=h1hNHBDAs5myCoMJ8DLqfHalw8NznJFDT0VKSaODJb0,23279
6
6
  pytest_regtest/register_third_party_handlers.py,sha256=mfmcyeMKuxFykkKLO7T1Tz5RPitn1pKLYRM7B9lA1Kg,1132
7
7
  pytest_regtest/snapshot_handler.py,sha256=MbWpNYOSkhQRs6U0qLT1kz5CV6JCay26yHntju8h9uU,6046
8
8
  pytest_regtest/utils.py,sha256=2jYTlV_qL5hH6FCeg7T1HJJvKual-Kux2scJ9_aB1lY,811
9
- pytest_regtest-2.3.5.dist-info/licenses/LICENSE.txt,sha256=Tue36uAzpW79-9WAqzkwPhsDDVd1X-VWUmdZ0MfGYvk,1068
10
- pytest_regtest-2.3.5.dist-info/METADATA,sha256=iMW7--UXXOHC0LILMuzLpF1BK3kCxph0rOkEUHRnS3U,3249
11
- pytest_regtest-2.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
- pytest_regtest-2.3.5.dist-info/entry_points.txt,sha256=4VuIhXeMGhDo0ATbaUfyjND0atofmZjV_P-o6_uEk2s,36
13
- pytest_regtest-2.3.5.dist-info/top_level.txt,sha256=vnqUV6AhbIRzZqEfkFhZBBSMoo-tvRkYGeo4KKida1U,15
14
- pytest_regtest-2.3.5.dist-info/RECORD,,
9
+ pytest_regtest-2.3.6.dist-info/licenses/LICENSE.txt,sha256=Tue36uAzpW79-9WAqzkwPhsDDVd1X-VWUmdZ0MfGYvk,1068
10
+ pytest_regtest-2.3.6.dist-info/METADATA,sha256=7yc9sUSAJCCdU-V4dJJiAvQ_Cx_6zDIQQUAOyEeo3UY,3199
11
+ pytest_regtest-2.3.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
12
+ pytest_regtest-2.3.6.dist-info/entry_points.txt,sha256=4VuIhXeMGhDo0ATbaUfyjND0atofmZjV_P-o6_uEk2s,36
13
+ pytest_regtest-2.3.6.dist-info/top_level.txt,sha256=vnqUV6AhbIRzZqEfkFhZBBSMoo-tvRkYGeo4KKida1U,15
14
+ pytest_regtest-2.3.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5