pytest-regtest 2.3.4__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.
- pytest_regtest/numpy_handler.py +1 -2
- pytest_regtest/pandas_handler.py +8 -13
- pytest_regtest/pytest_regtest.py +13 -7
- {pytest_regtest-2.3.4.dist-info → pytest_regtest-2.3.6.dist-info}/METADATA +3 -26
- pytest_regtest-2.3.6.dist-info/RECORD +14 -0
- {pytest_regtest-2.3.4.dist-info → pytest_regtest-2.3.6.dist-info}/WHEEL +1 -1
- pytest_regtest-2.3.4.dist-info/RECORD +0 -14
- {pytest_regtest-2.3.4.dist-info → pytest_regtest-2.3.6.dist-info}/entry_points.txt +0 -0
- {pytest_regtest-2.3.4.dist-info → pytest_regtest-2.3.6.dist-info}/licenses/LICENSE.txt +0 -0
- {pytest_regtest-2.3.4.dist-info → pytest_regtest-2.3.6.dist-info}/top_level.txt +0 -0
pytest_regtest/numpy_handler.py
CHANGED
|
@@ -145,8 +145,7 @@ class NumpyHandler(BaseSnapshotHandler):
|
|
|
145
145
|
" entries"
|
|
146
146
|
)
|
|
147
147
|
lines.append(
|
|
148
|
-
f"up to given precision settings rtol={self.rtol:e} and"
|
|
149
|
-
f" atol={self.atol:e}"
|
|
148
|
+
f"up to given precision settings rtol={self.rtol:e} and atol={self.atol:e}"
|
|
150
149
|
)
|
|
151
150
|
|
|
152
151
|
return lines
|
pytest_regtest/pandas_handler.py
CHANGED
|
@@ -75,21 +75,16 @@ class DataFrameHandler(BaseSnapshotHandler):
|
|
|
75
75
|
def extract(df, selector):
|
|
76
76
|
return df[[n for (n, t) in zip(df.columns, df.dtypes) if selector(t)]]
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
).to_numpy()
|
|
78
|
+
def is_float(t):
|
|
79
|
+
return t.type in (np.float64, np.float32)
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
current_reduced, lambda t: t.type is not np.float64
|
|
84
|
-
)
|
|
81
|
+
current_reduced_floats = extract(current_reduced, is_float).to_numpy()
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
recorded_reduced, lambda t: t.type is np.float64
|
|
88
|
-
).to_numpy()
|
|
83
|
+
current_reduced_other = extract(current_reduced, lambda t: not is_float(t))
|
|
89
84
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)
|
|
85
|
+
recorded_reduced_floats = extract(recorded_reduced, is_float).to_numpy()
|
|
86
|
+
|
|
87
|
+
recorded_reduced_other = extract(recorded_reduced, lambda t: not is_float(t))
|
|
93
88
|
|
|
94
89
|
return np.allclose(
|
|
95
90
|
current_reduced_floats,
|
|
@@ -97,7 +92,7 @@ class DataFrameHandler(BaseSnapshotHandler):
|
|
|
97
92
|
atol=self.atol,
|
|
98
93
|
rtol=self.rtol,
|
|
99
94
|
equal_nan=True,
|
|
100
|
-
) and
|
|
95
|
+
) and current_reduced_other.equals(recorded_reduced_other)
|
|
101
96
|
|
|
102
97
|
def show_differences(self, current, recorded, has_markup):
|
|
103
98
|
lines = []
|
pytest_regtest/pytest_regtest.py
CHANGED
|
@@ -108,7 +108,6 @@ class PytestRegtestPlugin:
|
|
|
108
108
|
if output_exception is not None:
|
|
109
109
|
raise output_exception
|
|
110
110
|
|
|
111
|
-
|
|
112
111
|
def check_recorded_output(self, item):
|
|
113
112
|
test_folder = item.fspath.dirname
|
|
114
113
|
regtest_stream = item.regtest_stream
|
|
@@ -257,7 +256,6 @@ class SnapshotPlugin:
|
|
|
257
256
|
if snapshot_exception is not None:
|
|
258
257
|
raise snapshot_exception
|
|
259
258
|
|
|
260
|
-
|
|
261
259
|
def check_snapshots(self, item):
|
|
262
260
|
results = []
|
|
263
261
|
|
|
@@ -273,7 +271,7 @@ class SnapshotPlugin:
|
|
|
273
271
|
return SnapshotException(results)
|
|
274
272
|
|
|
275
273
|
def check_snapshot(self, idx, item, snapshot):
|
|
276
|
-
handler, obj, version, _ = snapshot
|
|
274
|
+
handler, obj, failure_handler, version, _ = snapshot
|
|
277
275
|
|
|
278
276
|
test_folder = item.fspath.dirname
|
|
279
277
|
if version is not None:
|
|
@@ -323,6 +321,14 @@ class SnapshotPlugin:
|
|
|
323
321
|
ok = handler.compare(obj, recorded_obj)
|
|
324
322
|
if ok:
|
|
325
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
|
+
|
|
326
332
|
msg = handler.show_differences(obj, recorded_obj, has_markup)
|
|
327
333
|
return True, False, msg
|
|
328
334
|
|
|
@@ -347,7 +353,7 @@ class SnapshotPlugin:
|
|
|
347
353
|
path = item.fspath.relto(item.session.fspath)
|
|
348
354
|
code_lines = item.fspath.readlines()
|
|
349
355
|
|
|
350
|
-
for handler, obj, version, line_no in snapshots:
|
|
356
|
+
for handler, obj, failure_handler, version, line_no in snapshots:
|
|
351
357
|
info = code_lines[line_no - 1].strip()
|
|
352
358
|
tw.line(f"> {path} +{line_no}")
|
|
353
359
|
tw.line(f"> {info}")
|
|
@@ -394,7 +400,7 @@ class SnapshotPlugin:
|
|
|
394
400
|
colors.append(NO_COLOR)
|
|
395
401
|
|
|
396
402
|
for ok, snapshot, is_recorded, msg in exc_args[0]:
|
|
397
|
-
obj, version, kw, line_no = snapshot
|
|
403
|
+
obj, failure_handler, version, kw, line_no = snapshot
|
|
398
404
|
info = code_lines[line_no - 1].strip()
|
|
399
405
|
|
|
400
406
|
path = item.fspath.relto(item.session.fspath)
|
|
@@ -508,14 +514,14 @@ class Snapshot:
|
|
|
508
514
|
|
|
509
515
|
self.snapshots = []
|
|
510
516
|
|
|
511
|
-
def check(self, obj, *, version=None, **options):
|
|
517
|
+
def check(self, obj, *, failure_handler=None, version=None, **options):
|
|
512
518
|
handler_class = SnapshotHandlerRegistry.get_handler(obj)
|
|
513
519
|
if handler_class is None:
|
|
514
520
|
raise ValueError(f"no handler registered for {obj}")
|
|
515
521
|
|
|
516
522
|
handler = handler_class(options, self.request.config, tw)
|
|
517
523
|
line_no = inspect.currentframe().f_back.f_lineno
|
|
518
|
-
self.snapshots.append((handler, obj, version, line_no))
|
|
524
|
+
self.snapshots.append((handler, obj, failure_handler, version, line_no))
|
|
519
525
|
|
|
520
526
|
|
|
521
527
|
def cleanup(output, request):
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-regtest
|
|
3
|
-
Version: 2.3.
|
|
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
|
-
License: MIT
|
|
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
|
|
14
|
-
Classifier:
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
13
|
Description-Content-Type: text/markdown
|
|
16
14
|
License-File: LICENSE.txt
|
|
17
15
|
Requires-Dist: pytest>7.2
|
|
18
|
-
Provides-Extra: dev
|
|
19
|
-
Requires-Dist: twine; extra == "dev"
|
|
20
|
-
Requires-Dist: build; extra == "dev"
|
|
21
|
-
Requires-Dist: hatchling; extra == "dev"
|
|
22
|
-
Requires-Dist: wheel; extra == "dev"
|
|
23
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
24
|
-
Requires-Dist: ruff; extra == "dev"
|
|
25
|
-
Requires-Dist: black; extra == "dev"
|
|
26
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
27
|
-
Requires-Dist: numpy; extra == "dev"
|
|
28
|
-
Requires-Dist: pandas; extra == "dev"
|
|
29
|
-
Requires-Dist: mkdocs; extra == "dev"
|
|
30
|
-
Requires-Dist: mkdocs-material; extra == "dev"
|
|
31
|
-
Requires-Dist: mistletoe; extra == "dev"
|
|
32
|
-
Requires-Dist: mkdocs-awesome-pages-plugin; extra == "dev"
|
|
33
|
-
Requires-Dist: jinja2-cli; extra == "dev"
|
|
34
|
-
Requires-Dist: mkdocstrings[python]; extra == "dev"
|
|
35
|
-
Requires-Dist: numpy>=2; extra == "dev"
|
|
36
|
-
Requires-Dist: pandas>=2; extra == "dev"
|
|
37
|
-
Requires-Dist: polars>=1.9; extra == "dev"
|
|
38
|
-
Requires-Dist: md-transformer>=0.0.3; extra == "dev"
|
|
39
16
|
Dynamic: license-file
|
|
40
17
|
|
|
41
18
|

|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
pytest_regtest/__init__.py,sha256=GiURR8QAsu7GAVtbBEnwr1nNIcemLlcX7H5APQCb1ok,2535
|
|
2
|
+
pytest_regtest/numpy_handler.py,sha256=iuCN4fPr8ldEPeS5henmfmGg7nhFDjLMisgwotpm5rA,7157
|
|
3
|
+
pytest_regtest/pandas_handler.py,sha256=iDo5i5nSAYVWlOAps3pB3cbJmRvq1gHsWBF5y8f2M2c,4446
|
|
4
|
+
pytest_regtest/polars_handler.py,sha256=G25GmzZo95MzHoehvKXiv-SV8TkKA4TnLEqQ-nZa3d8,3796
|
|
5
|
+
pytest_regtest/pytest_regtest.py,sha256=h1hNHBDAs5myCoMJ8DLqfHalw8NznJFDT0VKSaODJb0,23279
|
|
6
|
+
pytest_regtest/register_third_party_handlers.py,sha256=mfmcyeMKuxFykkKLO7T1Tz5RPitn1pKLYRM7B9lA1Kg,1132
|
|
7
|
+
pytest_regtest/snapshot_handler.py,sha256=MbWpNYOSkhQRs6U0qLT1kz5CV6JCay26yHntju8h9uU,6046
|
|
8
|
+
pytest_regtest/utils.py,sha256=2jYTlV_qL5hH6FCeg7T1HJJvKual-Kux2scJ9_aB1lY,811
|
|
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,14 +0,0 @@
|
|
|
1
|
-
pytest_regtest/__init__.py,sha256=GiURR8QAsu7GAVtbBEnwr1nNIcemLlcX7H5APQCb1ok,2535
|
|
2
|
-
pytest_regtest/numpy_handler.py,sha256=hKrVY9dId-45rUR_83w9jbUWgUhd0ABk8uLbOhgm0IM,7173
|
|
3
|
-
pytest_regtest/pandas_handler.py,sha256=7vKaHyODcKMltgn9MbbbL1FsOBQK994dEY5fVlDoQ1g,4528
|
|
4
|
-
pytest_regtest/polars_handler.py,sha256=G25GmzZo95MzHoehvKXiv-SV8TkKA4TnLEqQ-nZa3d8,3796
|
|
5
|
-
pytest_regtest/pytest_regtest.py,sha256=MoKUuwG2hZGmJApuhgGN0PTVC4nRRk06MMknNEtZchc,22899
|
|
6
|
-
pytest_regtest/register_third_party_handlers.py,sha256=mfmcyeMKuxFykkKLO7T1Tz5RPitn1pKLYRM7B9lA1Kg,1132
|
|
7
|
-
pytest_regtest/snapshot_handler.py,sha256=MbWpNYOSkhQRs6U0qLT1kz5CV6JCay26yHntju8h9uU,6046
|
|
8
|
-
pytest_regtest/utils.py,sha256=2jYTlV_qL5hH6FCeg7T1HJJvKual-Kux2scJ9_aB1lY,811
|
|
9
|
-
pytest_regtest-2.3.4.dist-info/licenses/LICENSE.txt,sha256=Tue36uAzpW79-9WAqzkwPhsDDVd1X-VWUmdZ0MfGYvk,1068
|
|
10
|
-
pytest_regtest-2.3.4.dist-info/METADATA,sha256=lfwb5DvwQoZ_iR2eykuhf_PVL0AQ-MTCsF02Y8h6ABY,4157
|
|
11
|
-
pytest_regtest-2.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
pytest_regtest-2.3.4.dist-info/entry_points.txt,sha256=4VuIhXeMGhDo0ATbaUfyjND0atofmZjV_P-o6_uEk2s,36
|
|
13
|
-
pytest_regtest-2.3.4.dist-info/top_level.txt,sha256=vnqUV6AhbIRzZqEfkFhZBBSMoo-tvRkYGeo4KKida1U,15
|
|
14
|
-
pytest_regtest-2.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|