pytest-check 2.7.4__tar.gz → 2.7.5__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 (88) hide show
  1. {pytest_check-2.7.4 → pytest_check-2.7.5}/PKG-INFO +1 -1
  2. {pytest_check-2.7.4 → pytest_check-2.7.5}/changelog.md +9 -0
  3. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_mypy.py +46 -4
  4. pytest_check-2.7.5/examples/test_example_mypy_fail.py +27 -0
  5. {pytest_check-2.7.4 → pytest_check-2.7.5}/pyproject.toml +1 -1
  6. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/check_functions.py +44 -5
  7. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_xfail.py +6 -0
  8. {pytest_check-2.7.4 → pytest_check-2.7.5}/tox.ini +5 -2
  9. {pytest_check-2.7.4 → pytest_check-2.7.5}/.coveragerc +0 -0
  10. {pytest_check-2.7.4 → pytest_check-2.7.5}/.github/.deployment.md +0 -0
  11. {pytest_check-2.7.4 → pytest_check-2.7.5}/.github/FUNDING.yml +0 -0
  12. {pytest_check-2.7.4 → pytest_check-2.7.5}/.github/workflows/main.yml +0 -0
  13. {pytest_check-2.7.4 → pytest_check-2.7.5}/.github/workflows/publish-to-pypi.yml +0 -0
  14. {pytest_check-2.7.4 → pytest_check-2.7.5}/.gitignore +0 -0
  15. {pytest_check-2.7.4 → pytest_check-2.7.5}/LICENSE.txt +0 -0
  16. {pytest_check-2.7.4 → pytest_check-2.7.5}/README.md +0 -0
  17. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/logging_to_a_file/conftest.py +0 -0
  18. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/logging_to_a_file/test_file_logging.py +0 -0
  19. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_alt_names.py +0 -0
  20. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_any_failures.py +0 -0
  21. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_check_and_assert.py +0 -0
  22. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_check_check.py +0 -0
  23. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_check_func_decorator.py +0 -0
  24. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_check_not_in_test.py +0 -0
  25. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_context_functions.py +0 -0
  26. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_context_manager_fail.py +0 -0
  27. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_context_manager_pass.py +0 -0
  28. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_context_manager_type.py +0 -0
  29. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_fail_func.py +0 -0
  30. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_fail_in_fixture.py +0 -0
  31. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_fail_in_teardown_with_skip.py +0 -0
  32. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_fail_in_thread.py +0 -0
  33. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_functions_fail.py +0 -0
  34. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_functions_pass.py +0 -0
  35. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_helpers.py +0 -0
  36. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_httpx.py +0 -0
  37. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_locals.py +0 -0
  38. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_logging.py +0 -0
  39. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_maxfail.py +0 -0
  40. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_message.py +0 -0
  41. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_mix_checks_and_assertions.py +0 -0
  42. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_multiple_failures.py +0 -0
  43. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_pass_in_thread.py +0 -0
  44. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_raises.py +0 -0
  45. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_simple.py +0 -0
  46. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_speedup_funcs.py +0 -0
  47. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_stop_on_fail.py +0 -0
  48. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_summary.py +0 -0
  49. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_tb_style.py +0 -0
  50. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_traceback.py +0 -0
  51. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_tracebackhide.py +0 -0
  52. {pytest_check-2.7.4 → pytest_check-2.7.5}/examples/test_example_xfail.py +0 -0
  53. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/__init__.py +0 -0
  54. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/__init__.pyi +0 -0
  55. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/check_log.py +0 -0
  56. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/check_raises.py +0 -0
  57. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/context_manager.py +0 -0
  58. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/plugin.py +0 -0
  59. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/pseudo_traceback.py +0 -0
  60. {pytest_check-2.7.4 → pytest_check-2.7.5}/src/pytest_check/py.typed +0 -0
  61. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/__init__.py +0 -0
  62. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/conftest.py +0 -0
  63. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_alt_names.py +0 -0
  64. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_any_failures.py +0 -0
  65. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_check_and_assert.py +0 -0
  66. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_check_check.py +0 -0
  67. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_check_context_manager.py +0 -0
  68. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_check_fixture.py +0 -0
  69. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_check_func_decorator.py +0 -0
  70. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_fail_func.py +0 -0
  71. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_fail_in_fixture.py +0 -0
  72. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_fail_in_teardown_with_skip.py +0 -0
  73. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_functions.py +0 -0
  74. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_helpers.py +0 -0
  75. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_locals.py +0 -0
  76. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_logging.py +0 -0
  77. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_maxfail.py +0 -0
  78. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_message.py +0 -0
  79. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_not_in_test.py +0 -0
  80. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_raises.py +0 -0
  81. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_red.py +0 -0
  82. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_speedup_flags.py +0 -0
  83. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_speedup_functions.py +0 -0
  84. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_stop_on_fail.py +0 -0
  85. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_summary.py +0 -0
  86. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_tb_style.py +0 -0
  87. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_thread.py +0 -0
  88. {pytest_check-2.7.4 → pytest_check-2.7.5}/tests/test_tracebackhide.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-check
3
- Version: 2.7.4
3
+ Version: 2.7.5
4
4
  Summary: A pytest plugin that allows multiple failures per test.
5
5
  Project-URL: Home, https://github.com/okken/pytest-check
6
6
  Author: Brian Okken
@@ -28,6 +28,15 @@ All notable changes to this project will be documented in this file.
28
28
 
29
29
  -->
30
30
 
31
+ ## [2.7.5] - 2026-Mar-04
32
+
33
+ ### Changed
34
+
35
+ - Passing `None` to comparison functions like `greater()`, `less()`, etc. used to raise an exception, which caused a test failure and stopped the test.
36
+ - That's unexpected with a check function.
37
+ - So now the check fails with a meaningful error message and continues with the rest of the test.
38
+ - (typing) Allow numpy floats with comparison functions to pass mypy.
39
+
31
40
  ## [2.7.4] - 2026-Mar-03
32
41
 
33
42
  ### Fixed
@@ -7,16 +7,25 @@ Normally you would import the check functions like this:
7
7
  We're testing that an old form of import also works:
8
8
  import pytest_check as check
9
9
 
10
- However, please be aware that this method of importing is deprecated and
10
+ However, please be aware that this method of importing is deprecated and
11
11
  support may be removed in future versions.
12
12
 
13
13
  The original content of this file is from test_example_functions_pass.py.
14
- But I've also added more tests to check for anything I want to get
14
+ But I've also added more tests to check for anything I want to get
15
15
  tested with `mypy --strict`.
16
16
  """
17
17
 
18
- import pytest_check as check
19
18
  import math
19
+ import importlib
20
+ from typing import Any
21
+ import pytest
22
+ import pytest_check as check
23
+
24
+ try:
25
+ np: Any = importlib.import_module("numpy")
26
+ except ModuleNotFoundError:
27
+ np = None
28
+
20
29
 
21
30
  def test_equal() -> None:
22
31
  check.equal(1, 1)
@@ -100,11 +109,13 @@ def test_greater_equal() -> None:
100
109
  check.greater_equal(2, 1)
101
110
  check.greater_equal(1, 1)
102
111
 
103
- def test_greater_equal_int_float() -> None:
112
+
113
+ def test_int_float() -> None:
104
114
  check.greater(2, 1.9)
105
115
  check.greater_equal(2, 1.9)
106
116
  check.less(1.9, 2)
107
117
  check.less_equal(1.9, 2)
118
+ check.between(10, 4.5, 20)
108
119
 
109
120
 
110
121
  def test_less() -> None:
@@ -140,3 +151,34 @@ def test_between_equal() -> None:
140
151
  check.between_equal(0, 0, 20)
141
152
  check.between_equal(10, 0, 20)
142
153
  check.between_equal(20, 0, 20)
154
+
155
+
156
+ @pytest.mark.skipif(np is None, reason="numpy is not installed")
157
+ def test_greater_equal_max_int() -> None:
158
+ if np is not None:
159
+ check.greater_equal(np.iinfo(np.int32).max, 0)
160
+
161
+
162
+ @pytest.mark.skipif(np is None, reason="numpy is not installed")
163
+ def test_greater_equal_max_float() -> None:
164
+ if np is not None:
165
+ check.greater_equal(np.finfo(np.float32).max, 0)
166
+
167
+
168
+ @pytest.mark.skipif(np is None, reason="numpy is not installed")
169
+ def test_greater_max_int() -> None:
170
+ if np is not None:
171
+ check.greater(np.iinfo(np.int32).max, 0)
172
+
173
+
174
+ @pytest.mark.skipif(np is None, reason="numpy is not installed")
175
+ def test_less_min_float() -> None:
176
+ if np is not None:
177
+ check.less(np.finfo(np.float32).min, 0)
178
+
179
+
180
+ @pytest.mark.skipif(np is None, reason="numpy is not installed")
181
+ def test_less_equal_max_float() -> None:
182
+ if np is not None:
183
+ max_f32 = np.finfo(np.float32).max
184
+ check.less_equal(max_f32, max_f32)
@@ -0,0 +1,27 @@
1
+ import pytest
2
+ from pytest_check import check
3
+
4
+
5
+ @pytest.mark.xfail(reason="None cannot be compared")
6
+ def test_none_less() -> None:
7
+ check.less(None, 1)
8
+
9
+
10
+ @pytest.mark.xfail(reason="None cannot be compared")
11
+ def test_none_less_equal() -> None:
12
+ check.less_equal(None, 1)
13
+
14
+
15
+ @pytest.mark.xfail(reason="None cannot be compared")
16
+ def test_none_greater() -> None:
17
+ check.greater(1, None)
18
+
19
+
20
+ @pytest.mark.xfail(reason="None cannot be compared")
21
+ def test_none_greater_equal() -> None:
22
+ check.greater_equal(1, None)
23
+
24
+
25
+ @pytest.mark.xfail(reason="None cannot be compared")
26
+ def test_none_between() -> None:
27
+ check.between(1, None, 2)
@@ -4,7 +4,7 @@ authors = [{name = "Brian Okken"}]
4
4
  readme = "README.md"
5
5
  license = {file = "LICENSE.txt"}
6
6
  description="A pytest plugin that allows multiple failures per test."
7
- version = "2.7.4"
7
+ version = "2.7.5"
8
8
  requires-python = ">=3.9"
9
9
  classifiers = [
10
10
  'Development Status :: 5 - Production/Stable',
@@ -255,13 +255,22 @@ def not_almost_equal(
255
255
  def greater(a: float, b: float, msg: str = "") -> bool: ...
256
256
 
257
257
 
258
+ @overload
259
+ def greater(
260
+ a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
261
+ ) -> bool: ...
262
+
263
+
258
264
  @overload
259
265
  def greater(a: _ComparableGreaterThan[_CmpT], b: _CmpT, msg: str = "") -> bool: ...
260
266
 
261
267
 
262
268
  def greater(a: Any, b: Any, msg: str = "") -> bool:
263
269
  __tracebackhide__ = True
264
- if a > b:
270
+ if a is None or b is None:
271
+ log_failure(f"check {a} > {b}: None cannot be compared", msg)
272
+ return False
273
+ elif a > b:
265
274
  return True
266
275
  else:
267
276
  log_failure(f"check {a} > {b}", msg)
@@ -272,6 +281,12 @@ def greater(a: Any, b: Any, msg: str = "") -> bool:
272
281
  def greater_equal(a: float, b: float, msg: str = "") -> bool: ...
273
282
 
274
283
 
284
+ @overload
285
+ def greater_equal(
286
+ a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
287
+ ) -> bool: ...
288
+
289
+
275
290
  @overload
276
291
  def greater_equal(
277
292
  a: _ComparableGreaterThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
@@ -280,7 +295,10 @@ def greater_equal(
280
295
 
281
296
  def greater_equal(a: Any, b: Any, msg: str = "") -> bool:
282
297
  __tracebackhide__ = True
283
- if a >= b:
298
+ if a is None or b is None:
299
+ log_failure(f"check {a} >= {b}: None cannot be compared", msg)
300
+ return False
301
+ elif a >= b:
284
302
  return True
285
303
  else:
286
304
  log_failure(f"check {a} >= {b}", msg)
@@ -291,13 +309,22 @@ def greater_equal(a: Any, b: Any, msg: str = "") -> bool:
291
309
  def less(a: float, b: float, msg: str = "") -> bool: ...
292
310
 
293
311
 
312
+ @overload
313
+ def less(
314
+ a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
315
+ ) -> bool: ...
316
+
317
+
294
318
  @overload
295
319
  def less(a: _ComparableLessThan[_CmpT], b: _CmpT, msg: str = "") -> bool: ...
296
320
 
297
321
 
298
322
  def less(a: Any, b: Any, msg: str = "") -> bool:
299
323
  __tracebackhide__ = True
300
- if a < b:
324
+ if a is None or b is None:
325
+ log_failure(f"check {a} < {b}: None cannot be compared", msg)
326
+ return False
327
+ elif a < b:
301
328
  return True
302
329
  else:
303
330
  log_failure(f"check {a} < {b}", msg)
@@ -308,6 +335,12 @@ def less(a: Any, b: Any, msg: str = "") -> bool:
308
335
  def less_equal(a: float, b: float, msg: str = "") -> bool: ...
309
336
 
310
337
 
338
+ @overload
339
+ def less_equal(
340
+ a: SupportsFloat | SupportsIndex, b: SupportsFloat | SupportsIndex, msg: str = ""
341
+ ) -> bool: ...
342
+
343
+
311
344
  @overload
312
345
  def less_equal(
313
346
  a: _ComparableLessThanOrEqual[_CmpT], b: _CmpT, msg: str = ""
@@ -316,7 +349,10 @@ def less_equal(
316
349
 
317
350
  def less_equal(a: Any, b: Any, msg: str = "") -> bool:
318
351
  __tracebackhide__ = True
319
- if a <= b:
352
+ if a is None or b is None:
353
+ log_failure(f"check {a} <= {b}: None cannot be compared", msg)
354
+ return False
355
+ elif a <= b:
320
356
  return True
321
357
  else:
322
358
  log_failure(f"check {a} <= {b}", msg)
@@ -327,7 +363,10 @@ def between(
327
363
  b: Any, a: Any, c: Any, msg: str = "", ge: bool = False, le: bool = False
328
364
  ) -> bool:
329
365
  __tracebackhide__ = True
330
- if ge and le:
366
+ if a is None or b is None or c is None:
367
+ log_failure(f"check {a} <= {b} <= {c}: None cannot be compared", msg)
368
+ return False
369
+ elif ge and le:
331
370
  if a <= b <= c:
332
371
  return True
333
372
  else:
@@ -102,3 +102,9 @@ def test_xfail_raises_multiple_marks_one_matches(pytester):
102
102
  )
103
103
  result.assert_outcomes(xfailed=1)
104
104
  result.stdout.fnmatch_lines(["* 1 xfailed *"])
105
+
106
+ def test_xfail_mypy(pytester):
107
+ pytester.copy_example("examples/test_example_mypy_fail.py")
108
+ result = pytester.runpytest("test_example_mypy_fail.py")
109
+ result.assert_outcomes(xfailed=5)
110
+ result.stdout.fnmatch_lines(["* 5 xfailed *"])
@@ -44,6 +44,7 @@ description = Run ruff over src, test, examples
44
44
  deps =
45
45
  mypy
46
46
  httpx
47
+ numpy
47
48
  # pluggy added type checking support in version 1.3.0
48
49
  pluggy>=1.3,<2
49
50
  base_python = python3.14
@@ -54,8 +55,10 @@ commands =
54
55
  # don't need strict for internal tests
55
56
  mypy --pretty tests
56
57
 
57
- # for one example test, try full strict
58
- mypy --pretty --strict examples/test_example_mypy.py
58
+ # tests that support --strict
59
+ mypy --pretty --strict \
60
+ examples/test_example_mypy.py \
61
+ examples/test_example_mypy_fail.py
59
62
 
60
63
  # for most examples, I'd like to not use all type hints to aid in readability
61
64
  ; --strict # mostly strict
File without changes
File without changes
File without changes
File without changes