pytest-check 3.0.0__tar.gz → 3.0.2__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 (106) hide show
  1. {pytest_check-3.0.0 → pytest_check-3.0.2}/.github/workflows/main.yml +1 -1
  2. {pytest_check-3.0.0 → pytest_check-3.0.2}/PKG-INFO +1 -1
  3. {pytest_check-3.0.0 → pytest_check-3.0.2}/changelog.md +21 -0
  4. pytest_check-3.0.2/examples/test_example_isolated_asyncio.py +19 -0
  5. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_locals.py +2 -1
  6. {pytest_check-3.0.0 → pytest_check-3.0.2}/pyproject.toml +1 -1
  7. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/check_log.py +14 -4
  8. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/plugin.py +1 -0
  9. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/pseudo_traceback.py +9 -1
  10. pytest_check-3.0.2/tests/test_isolated_asyncio.py +6 -0
  11. pytest_check-3.0.2/tests/test_locals.py +30 -0
  12. {pytest_check-3.0.0 → pytest_check-3.0.2}/tox.ini +16 -26
  13. pytest_check-3.0.0/tests/test_locals.py +0 -19
  14. {pytest_check-3.0.0 → pytest_check-3.0.2}/.coveragerc +0 -0
  15. {pytest_check-3.0.0 → pytest_check-3.0.2}/.github/.deployment.md +0 -0
  16. {pytest_check-3.0.0 → pytest_check-3.0.2}/.github/FUNDING.yml +0 -0
  17. {pytest_check-3.0.0 → pytest_check-3.0.2}/.github/workflows/publish-to-pypi.yml +0 -0
  18. {pytest_check-3.0.0 → pytest_check-3.0.2}/.gitignore +0 -0
  19. {pytest_check-3.0.0 → pytest_check-3.0.2}/LICENSE.txt +0 -0
  20. {pytest_check-3.0.0 → pytest_check-3.0.2}/README.md +0 -0
  21. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/logging_to_a_file/conftest.py +0 -0
  22. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/logging_to_a_file/test_file_logging.py +0 -0
  23. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_alt_names.py +0 -0
  24. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_any_failures.py +0 -0
  25. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_check_and_assert.py +0 -0
  26. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_check_check.py +0 -0
  27. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_check_func_decorator.py +0 -0
  28. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_check_func_xfail.py +0 -0
  29. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_check_not_in_test.py +0 -0
  30. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_context_functions.py +0 -0
  31. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_context_manager_fail.py +0 -0
  32. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_context_manager_pass.py +0 -0
  33. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_context_manager_type.py +0 -0
  34. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_fail_func.py +0 -0
  35. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_fail_in_fixture.py +0 -0
  36. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_fail_in_teardown_with_skip.py +0 -0
  37. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_fail_in_thread.py +0 -0
  38. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_functions_fail.py +0 -0
  39. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_functions_pass.py +0 -0
  40. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_functions_xfail.py +0 -0
  41. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_helpers.py +0 -0
  42. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_httpx.py +0 -0
  43. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_logging.py +0 -0
  44. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_loop.py +0 -0
  45. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_maxfail.py +0 -0
  46. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_message.py +0 -0
  47. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_mix_checks_and_assertions.py +0 -0
  48. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_multi.py +0 -0
  49. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_multi_check_raises.py +0 -0
  50. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_multiple_failures.py +0 -0
  51. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_mypy.py +0 -0
  52. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_mypy_fail.py +0 -0
  53. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_non_assert_exceptions.py +0 -0
  54. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_parallel_threads.py +0 -0
  55. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_pass_in_thread.py +0 -0
  56. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_raises.py +0 -0
  57. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_simple.py +0 -0
  58. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_speedup_funcs.py +0 -0
  59. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_stop_on_fail.py +0 -0
  60. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_summary.py +0 -0
  61. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_tb_style.py +0 -0
  62. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_traceback.py +0 -0
  63. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_tracebackhide.py +0 -0
  64. {pytest_check-3.0.0 → pytest_check-3.0.2}/examples/test_example_xfail.py +0 -0
  65. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/__init__.py +0 -0
  66. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/__init__.pyi +0 -0
  67. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/check_functions.py +0 -0
  68. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/check_raises.py +0 -0
  69. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/context_manager.py +0 -0
  70. {pytest_check-3.0.0 → pytest_check-3.0.2}/src/pytest_check/py.typed +0 -0
  71. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/__init__.py +0 -0
  72. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/conftest.py +0 -0
  73. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/markers.py +0 -0
  74. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_alt_names.py +0 -0
  75. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_any_failures.py +0 -0
  76. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_check_and_assert.py +0 -0
  77. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_check_check.py +0 -0
  78. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_check_context_manager.py +0 -0
  79. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_check_fixture.py +0 -0
  80. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_check_func_decorator.py +0 -0
  81. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_fail_func.py +0 -0
  82. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_fail_in_fixture.py +0 -0
  83. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_fail_in_teardown_with_skip.py +0 -0
  84. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_func_xfail.py +0 -0
  85. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_functions.py +0 -0
  86. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_helpers.py +0 -0
  87. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_logging.py +0 -0
  88. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_maxfail.py +0 -0
  89. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_message.py +0 -0
  90. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_non_assert_exceptions.py +0 -0
  91. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_not_in_test.py +0 -0
  92. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_parallel_threads.py +0 -0
  93. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_pseudo_tb_corner_cases.py +0 -0
  94. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_raises.py +0 -0
  95. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_red.py +0 -0
  96. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_reportlog.py +0 -0
  97. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_speedup_flags.py +0 -0
  98. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_speedup_functions.py +0 -0
  99. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_stop_on_fail.py +0 -0
  100. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_summary.py +0 -0
  101. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_tb_line.py +0 -0
  102. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_tb_style.py +0 -0
  103. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_thread.py +0 -0
  104. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_thread_runner_compat.py +0 -0
  105. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_tracebackhide.py +0 -0
  106. {pytest_check-3.0.0 → pytest_check-3.0.2}/tests/test_xfail.py +0 -0
@@ -42,7 +42,7 @@ jobs:
42
42
  - name: Install Tox and any other packages
43
43
  run: pip install tox tox-uv
44
44
  - name: Run Tox quality checks
45
- run: tox -e lint,mypy
45
+ run: tox -p -m static-analysis
46
46
 
47
47
  pytest-7-earliest:
48
48
  runs-on: ubuntu-latest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pytest-check
3
- Version: 3.0.0
3
+ Version: 3.0.2
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
@@ -39,10 +39,30 @@ TEMPLATE_START
39
39
 
40
40
  - nothing so far
41
41
 
42
+ ### Developer Experience
43
+
44
+ - nothing so far
45
+
42
46
  TEMPLATE_END
43
47
 
44
48
  -->
45
49
 
50
+ ## [3.0.2] - 13-Oct-2026
51
+
52
+ ### Fixed
53
+
54
+ - Report failed checks correctly in `unittest.IsolatedAsyncioTestCase` tests (issue #210).
55
+
56
+ ### Developer Experience
57
+
58
+ - Split mypy checks into separate tox environments so they can run in parallel with `tox -p`.
59
+
60
+ ## [3.0.1] - 12-Oct-2026
61
+
62
+ ### Fixed
63
+
64
+ - Truncate long local values in check pseudo tracebacks with `-l` or `-lv`, while preserving full values with `-lvv` (issue #208). Thanks [Neallin-917](https://github.com/Neallin-917)
65
+
46
66
  ## [3.0.0] - 10-Oct-2026
47
67
 
48
68
  ### Highlights
@@ -52,6 +72,7 @@ TEMPLATE_END
52
72
  ### Migration Notes
53
73
 
54
74
  - Failures raised in helper threads remain part of their parent test's report. When reading `check_log` from a worker thread, its failure state is now independent of other concurrently running threads.
75
+ - Thanks [dpadninja](https://github.com/dpadninja) for getting the ball rolling on this
55
76
 
56
77
  ### Changed
57
78
 
@@ -0,0 +1,19 @@
1
+ """
2
+ This was something that failed correctly pre 3.0.0
3
+ Specifically, it was failing correctly in version 2.9.1
4
+ And passed incorrectly in 3.0.0 and 3.0.1
5
+
6
+ Issue #210:
7
+ pytest-check 3.0: failed checks in IsolatedAsyncioTestCase tests
8
+ are not reported
9
+ """
10
+
11
+ import unittest
12
+
13
+ from pytest_check import check
14
+
15
+
16
+ class TestAsync(unittest.IsolatedAsyncioTestCase):
17
+ async def test_failed_check(self):
18
+ with check:
19
+ self.fail("async check failed")
@@ -4,9 +4,9 @@ Make sure locals can be viewed with -l or --showlocals
4
4
 
5
5
  from pytest_check import check
6
6
 
7
-
8
7
  def test_ctx():
9
8
  a = 1
9
+ big_local = list(range(100)) # noqa: F841
10
10
  with check:
11
11
  b = 2
12
12
  assert a == b
@@ -14,4 +14,5 @@ def test_ctx():
14
14
  def test_check_func():
15
15
  a = 1
16
16
  b = 2
17
+ big_local = list(range(100)) # noqa: F841
17
18
  check.equal(a, b)
@@ -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 = "3.0.0"
7
+ version = "3.0.2"
8
8
  requires-python = ">=3.9"
9
9
  classifiers = [
10
10
  'Development Status :: 5 - Production/Stable',
@@ -63,6 +63,18 @@ class _CheckState:
63
63
  self._children.append(child)
64
64
  return child
65
65
 
66
+ def clear(self) -> None:
67
+ """Reset per-test data in place so copied async contexts still see it."""
68
+ self.failures = []
69
+ self.num_failures = 0
70
+ self.max_fail = _default_max_fail
71
+ self.max_report = _default_max_report
72
+ self.max_tb = _default_max_tb
73
+ self.max_tb_line = _default_max_tb_line
74
+ self.xfailed_failure = None
75
+ with self._children_lock:
76
+ self._children = []
77
+
66
78
  def _snapshot_children(self) -> list[_CheckState]:
67
79
  with self._children_lock:
68
80
  return list(self._children)
@@ -167,7 +179,7 @@ def _propagate_context_to_new_threads() -> None:
167
179
 
168
180
  ctx.run(body)
169
181
 
170
- self.run = run_in_context # type: ignore[method-assign]
182
+ self.run = run_in_context # type: ignore[method-assign] # ty: ignore[invalid-assignment]
171
183
  original_start(self)
172
184
 
173
185
  threading.Thread.start = start_with_context # type: ignore[method-assign]
@@ -178,9 +190,7 @@ _propagate_context_to_new_threads()
178
190
 
179
191
  def clear_failures() -> None:
180
192
  # gets called at the beginning of each test function
181
- state = _CheckState()
182
- state.fail_function = _current_state().fail_function
183
- _state_var.set(state)
193
+ _current_state().clear()
184
194
 
185
195
 
186
196
  def any_failures() -> bool:
@@ -186,6 +186,7 @@ def pytest_configure(config: Config) -> None:
186
186
  traceback_style = config.getoption("tbstyle", default=None)
187
187
  pseudo_traceback._traceback_style = traceback_style
188
188
  check_log._showlocals = config.getoption("showlocals", default=None)
189
+ pseudo_traceback._truncate_locals = config.getoption("verbose", default=0) <= 1
189
190
 
190
191
  # grab options
191
192
  check_log._default_max_fail = config.getoption("--check-max-fail")
@@ -8,6 +8,8 @@ from inspect import FrameInfo
8
8
  from pprint import pformat
9
9
  from typing import AnyStr, Any
10
10
 
11
+ from _pytest._io.saferepr import saferepr
12
+
11
13
  if sys.version_info < (3, 11): # pragma: no cover
12
14
  from typing_extensions import LiteralString
13
15
  else:
@@ -15,6 +17,7 @@ else:
15
17
 
16
18
 
17
19
  _traceback_style = "auto"
20
+ _truncate_locals = True
18
21
 
19
22
 
20
23
  def get_full_context(
@@ -196,7 +199,12 @@ def _build_pseudo_trace_str(
196
199
  if not name.startswith("@py"):
197
200
  pseudo_trace.append(
198
201
  "%-10s = %s"
199
- % (name, pformat(val, sort_dicts=False, compact=True))
202
+ % (
203
+ name,
204
+ saferepr(val)
205
+ if _truncate_locals
206
+ else pformat(val, sort_dicts=False, compact=True),
207
+ )
200
208
  )
201
209
 
202
210
  if color:
@@ -0,0 +1,6 @@
1
+ from typing import Callable
2
+
3
+
4
+ def test_isolated_asyncio(run_example_test: Callable) -> None:
5
+ result = run_example_test("test_example_isolated_asyncio.py")
6
+ result.assert_outcomes(failed=1)
@@ -0,0 +1,30 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.mark.parametrize("check_style", ["function", "context"])
5
+ def test_locals(pytester, check_style):
6
+ pytester.copy_example("examples/test_example_locals.py")
7
+ test_func = "test_check_func" if check_style == "function" else "test_ctx"
8
+ result = pytester.runpytest(f"test_example_locals.py::{test_func}", "-l")
9
+ result.assert_outcomes(failed=1)
10
+ result.stdout.fnmatch_lines([
11
+ "*a *= 1*",
12
+ "*b *= 2*"
13
+ ])
14
+
15
+
16
+ @pytest.mark.parametrize("verbosity", [[], ["-v"], ["-vv"]], ids=["default", "v", "vv"])
17
+ @pytest.mark.parametrize("check_style", ["function", "context"])
18
+ def test_long_locals_follow_verbosity(pytester, verbosity, check_style):
19
+ pytester.copy_example("examples/test_example_locals.py")
20
+ test_func = "test_check_func" if check_style == "function" else "test_ctx"
21
+ result = pytester.runpytest(f"test_example_locals.py::{test_func}",
22
+ "--showlocals", *verbosity)
23
+ result.assert_outcomes(failed=1)
24
+ output = result.stdout.str()
25
+ assert "big_local" in output
26
+ if verbosity == ["-vv"]:
27
+ assert "99" in output
28
+ else:
29
+ assert "99" not in output
30
+ assert "..." in output
@@ -20,7 +20,14 @@ env_list =
20
20
  coverage
21
21
  lint
22
22
  ty
23
- mypy
23
+ mypy-src
24
+ mypy-tests
25
+ mypy-example
26
+ mypy-examples
27
+
28
+ labels =
29
+ mypy = mypy-src, mypy-tests, mypy-example, mypy-examples
30
+ static-analysis = lint, mypy-src, mypy-tests, mypy-example, mypy-examples
24
31
 
25
32
  skip_missing_interpreters = true
26
33
 
@@ -127,7 +134,7 @@ base_python = python3.14
127
134
  commands = ruff check src tests examples
128
135
  description = Run ruff over src, test, examples
129
136
 
130
- [testenv:mypy]
137
+ [testenv:mypy-{src,tests,example,examples}]
131
138
  deps =
132
139
  mypy
133
140
  httpx
@@ -135,31 +142,14 @@ deps =
135
142
  # pluggy added type checking support in version 1.3.0
136
143
  pluggy>=1.3
137
144
  base_python = python3.14
145
+ set_env =
146
+ MYPY_CACHE_DIR = {env_dir}/.mypy_cache
138
147
  commands =
139
- # want strict for src so users can use strict if they want
140
- mypy --strict src
141
-
142
- # don't need strict for internal tests
143
- mypy tests
144
-
145
- # tests that support --strict
146
- mypy --strict examples/test_example_mypy.py
147
-
148
- # considering ways to make sure this fails
149
- # mypy --strict examples/test_example_mypy_fail.py
150
-
151
- # for most examples, I'd like to not use all type hints to aid in readability
152
- ; --strict # mostly strict
153
- ; --allow-untyped-defs # don't require "-> None" type hints
154
- ; --disable-error-code=comparison-overlap # allow assert 1 == 2
155
- ; --disable-error-code=no-untyped-call # allow calls to helper functions with no type hints
156
- ; exclude examples that are intentionally type-invalid to test runtime behavior
157
- mypy --pretty --strict \
158
- --allow-untyped-defs \
159
- --disable-error-code=comparison-overlap \
160
- --disable-error-code=no-untyped-call \
161
- examples --exclude examples/test_example_mypy_fail.py|examples/test_example_multi_check_raises.py
162
- description = Run mypy over src, test, examples
148
+ src: mypy --strict src
149
+ tests: mypy tests
150
+ example: mypy --strict examples/test_example_mypy.py
151
+ examples: mypy --pretty --strict --allow-untyped-defs --disable-error-code=comparison-overlap --disable-error-code=no-untyped-call examples --exclude examples/test_example_mypy_fail.py|examples/test_example_multi_check_raises.py
152
+ description = Run mypy for {envname}
163
153
 
164
154
  [testenv:ty]
165
155
  deps =
@@ -1,19 +0,0 @@
1
- def test_locals_context_manager(pytester):
2
- pytester.copy_example("examples/test_example_locals.py")
3
- result = pytester.runpytest("test_example_locals.py::test_ctx", "-l")
4
- result.assert_outcomes(failed=1)
5
- result.stdout.fnmatch_lines([
6
- "*a *= 1*",
7
- "*b *= 2*"
8
- ])
9
-
10
-
11
- def test_locals_check_function(pytester):
12
- pytester.copy_example("examples/test_example_locals.py")
13
- result = pytester.runpytest("test_example_locals.py::test_check_func",
14
- "--showlocals")
15
- result.assert_outcomes(failed=1)
16
- result.stdout.fnmatch_lines([
17
- "*a *= 1*",
18
- "*b *= 2*"
19
- ])
File without changes
File without changes
File without changes
File without changes