pytest-regtest 2.3.3__tar.gz → 2.3.4__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.
Files changed (30) hide show
  1. {pytest_regtest-2.3.3/src/pytest_regtest.egg-info → pytest_regtest-2.3.4}/PKG-INFO +24 -2
  2. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/pyproject.toml +3 -3
  3. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/__init__.py +0 -1
  4. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/pytest_regtest.py +16 -6
  5. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4/src/pytest_regtest.egg-info}/PKG-INFO +24 -2
  6. pytest_regtest-2.3.4/src/pytest_regtest.egg-info/requires.txt +23 -0
  7. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_regtest.py +49 -2
  8. pytest_regtest-2.3.3/src/pytest_regtest.egg-info/requires.txt +0 -1
  9. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/LICENSE.txt +0 -0
  10. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/MANIFEST.in +0 -0
  11. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/README.md +0 -0
  12. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/setup.cfg +0 -0
  13. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/numpy_handler.py +0 -0
  14. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/pandas_handler.py +0 -0
  15. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/polars_handler.py +0 -0
  16. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/register_third_party_handlers.py +0 -0
  17. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/snapshot_handler.py +0 -0
  18. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest/utils.py +0 -0
  19. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest.egg-info/SOURCES.txt +0 -0
  20. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest.egg-info/dependency_links.txt +0 -0
  21. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest.egg-info/entry_points.txt +0 -0
  22. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/src/pytest_regtest.egg-info/top_level.txt +0 -0
  23. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/conftest.py +0 -0
  24. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_cli.py +0 -0
  25. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_snapshot.py +0 -0
  26. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_snapshot_numpy.py +0 -0
  27. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_snapshot_pandas.py +0 -0
  28. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_snapshot_polars.py +0 -0
  29. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_snapshot_python_types.py +0 -0
  30. {pytest_regtest-2.3.3 → pytest_regtest-2.3.4}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-regtest
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: pytest plugin for snapshot regression testing
5
5
  Author-email: Uwe Schmitt <uwe.schmitt@id.ethz.ch>
6
6
  License: MIT License
@@ -15,6 +15,28 @@ Classifier: License :: OSI Approved :: MIT License
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE.txt
17
17
  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
+ Dynamic: license-file
18
40
 
19
41
  ![](https://gitlab.com/uweschmitt/pytest-regtest/badges/main/pipeline.svg)
20
42
  ![](https://gitlab.com/uweschmitt/pytest-regtest/badges/main/coverage.svg?job=coverage)
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "pytest-regtest"
9
- version = "2.3.3"
9
+ version = "2.3.4"
10
10
  description = "pytest plugin for snapshot regression testing"
11
11
  readme = "README.md"
12
12
  authors = [
@@ -43,8 +43,8 @@ exclude = ["_regtest_output"]
43
43
  [tool.ruff.lint]
44
44
  ignore = ["E731", "E203"]
45
45
 
46
- [tool.uv]
47
- dev-dependencies = [
46
+ [project.optional-dependencies]
47
+ dev = [
48
48
  "twine", "build", "hatchling", "wheel", "pre-commit", "ruff", "black",
49
49
  "pytest-cov", "numpy", "pandas", "mkdocs", "mkdocs-material", "mistletoe",
50
50
  "mkdocs-awesome-pages-plugin", "jinja2-cli", "mkdocstrings[python]",
@@ -18,7 +18,6 @@ from .register_third_party_handlers import (
18
18
  register_pandas_handler,
19
19
  register_polars_handler,
20
20
  )
21
-
22
21
  from .snapshot_handler import register_python_object_handler
23
22
 
24
23
  __version__ = _version(__package__)
@@ -108,9 +108,6 @@ class PytestRegtestPlugin:
108
108
  if output_exception is not None:
109
109
  raise output_exception
110
110
 
111
- if item.get_closest_marker("xfail") and item.config.getvalue("--regtest-reset"):
112
- # enforce consistency with xfail:
113
- assert False
114
111
 
115
112
  def check_recorded_output(self, item):
116
113
  test_folder = item.fspath.dirname
@@ -127,6 +124,14 @@ class PytestRegtestPlugin:
127
124
  consider_line_endings = config.getvalue("--regtest-consider-line-endings")
128
125
  reset = config.getvalue("--regtest-reset")
129
126
 
127
+ # Skip reset for xfail tests that are actually expected to fail
128
+ xfail_marker = item.get_closest_marker("xfail")
129
+ if xfail_marker:
130
+ # Check if xfail condition evaluates to True
131
+ condition = xfail_marker.kwargs.get("condition", True)
132
+ if condition is True or (condition is not False and condition):
133
+ reset = False
134
+
130
135
  if reset:
131
136
  os.makedirs(os.path.dirname(recorded_output_path), exist_ok=True)
132
137
  with open(recorded_output_path + ".out", "w", encoding="utf-8") as fh:
@@ -252,9 +257,6 @@ class SnapshotPlugin:
252
257
  if snapshot_exception is not None:
253
258
  raise snapshot_exception
254
259
 
255
- if item.get_closest_marker("xfail") and item.config.getvalue("--regtest-reset"):
256
- # enforce fail
257
- assert False
258
260
 
259
261
  def check_snapshots(self, item):
260
262
  results = []
@@ -287,6 +289,14 @@ class SnapshotPlugin:
287
289
 
288
290
  reset = config.getvalue("--regtest-reset")
289
291
 
292
+ # Skip reset for xfail tests that are actually expected to fail
293
+ xfail_marker = item.get_closest_marker("xfail")
294
+ if xfail_marker:
295
+ # Check if xfail condition evaluates to True
296
+ condition = xfail_marker.kwargs.get("condition", True)
297
+ if condition is True or (condition is not False and condition):
298
+ reset = False
299
+
290
300
  if reset:
291
301
  os.makedirs(recorded_output_path, exist_ok=True)
292
302
  handler.save(recorded_output_path, obj)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-regtest
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: pytest plugin for snapshot regression testing
5
5
  Author-email: Uwe Schmitt <uwe.schmitt@id.ethz.ch>
6
6
  License: MIT License
@@ -15,6 +15,28 @@ Classifier: License :: OSI Approved :: MIT License
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE.txt
17
17
  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
+ Dynamic: license-file
18
40
 
19
41
  ![](https://gitlab.com/uweschmitt/pytest-regtest/badges/main/pipeline.svg)
20
42
  ![](https://gitlab.com/uweschmitt/pytest-regtest/badges/main/coverage.svg?job=coverage)
@@ -0,0 +1,23 @@
1
+ pytest>7.2
2
+
3
+ [dev]
4
+ twine
5
+ build
6
+ hatchling
7
+ wheel
8
+ pre-commit
9
+ ruff
10
+ black
11
+ pytest-cov
12
+ numpy
13
+ pandas
14
+ mkdocs
15
+ mkdocs-material
16
+ mistletoe
17
+ mkdocs-awesome-pages-plugin
18
+ jinja2-cli
19
+ mkdocstrings[python]
20
+ numpy>=2
21
+ pandas>=2
22
+ polars>=1.9
23
+ md-transformer>=0.0.3
@@ -135,11 +135,13 @@ def test_xfail(testdir, assert_outcomes):
135
135
  result = testdir.runpytest()
136
136
  assert_outcomes(result, xfailed=1)
137
137
 
138
+ # With --regtest-reset, xfail tests are not reset (output not recorded)
138
139
  result = testdir.runpytest("--regtest-reset")
139
140
  assert_outcomes(result, xfailed=1)
140
141
 
142
+ # Run again - still xfailed because no output was recorded
141
143
  result = testdir.runpytest()
142
- assert_outcomes(result, xpassed=1)
144
+ assert_outcomes(result, xfailed=1)
143
145
 
144
146
 
145
147
  def test_xfail_strict(testdir, assert_outcomes):
@@ -161,11 +163,56 @@ def test_xfail_strict(testdir, assert_outcomes):
161
163
  result = testdir.runpytest()
162
164
  assert_outcomes(result, failed=0, passed=0, xfailed=1)
163
165
 
166
+ # With --regtest-reset, xfail tests are not reset (output not recorded)
164
167
  result = testdir.runpytest("--regtest-reset")
165
168
  assert_outcomes(result, xfailed=1)
166
169
 
170
+ # Run again - still xfailed because no output was recorded
171
+ # With strict=True, an xpass would become a failure, but this stays xfailed
167
172
  result = testdir.runpytest()
168
- assert_outcomes(result, failed=1)
173
+ assert_outcomes(result, xfailed=1)
174
+
175
+
176
+ def test_conditional_xfail(testdir, assert_outcomes):
177
+ testdir.makepyfile(
178
+ """
179
+ import sys
180
+ import pytest
181
+
182
+ @pytest.mark.xfail(condition=sys.platform == "win32", reason="Windows only")
183
+ def test_conditional_xfail_windows(regtest_all):
184
+ print("This test is xfailed on Windows only")
185
+ print(f"Platform: {sys.platform}")
186
+ # This should pass on non-Windows
187
+
188
+ @pytest.mark.xfail(condition=sys.platform != "win32", reason="Non-Windows only")
189
+ def test_conditional_xfail_non_windows(regtest_all):
190
+ print("This test is xfailed on non-Windows only")
191
+ print(f"Platform: {sys.platform}")
192
+ # This should pass on Windows
193
+ """
194
+ )
195
+
196
+ # Run initially - one should fail (no recorded output), one should xfail
197
+ result = testdir.runpytest()
198
+ assert_outcomes(result, failed=1, xfailed=1)
199
+
200
+ # Run with --regtest-reset
201
+ # xfail tests should NOT be reset - they run but output is not recorded
202
+ # The non-xfailed test gets reset, the xfailed one still fails (no output file)
203
+ result = testdir.runpytest("--regtest-reset")
204
+ if IS_WIN:
205
+ # On Windows: test_windows is xfailed, test_non_windows gets reset
206
+ assert_outcomes(result, passed=1, xfailed=1)
207
+ else:
208
+ # On non-Windows: test_windows gets reset, test_non_windows is xfailed
209
+ assert_outcomes(result, passed=1, xfailed=1)
210
+
211
+ # Run again to verify
212
+ # The non-xfailed test should pass (was reset)
213
+ # The xfailed test should still fail (no output file was created)
214
+ result = testdir.runpytest()
215
+ assert_outcomes(result, passed=1, xfailed=1)
169
216
 
170
217
 
171
218
  def test_failed_test(testdir, assert_outcomes):
@@ -1 +0,0 @@
1
- pytest>7.2
File without changes
File without changes