Registry / testing / pytest-check

pytest-check

JSON →
library2.9.1pypypi✓ verified 28d ago

pytest-check is a pytest plugin that extends standard pytest functionality to allow multiple assertion failures within a single test function without immediately stopping test execution. Instead of failing on the first `assert`, it collects all 'checks' and reports them at the end of the test. The current version is 2.8.0, and it maintains an active release cadence with regular updates.

pip install pytest-check
INSTALL
IMPORT
SIG · PYTEST-CHECK
P
pytest-check
testingpythonv2.9.1
Install
2.8s avg
Import
418ms
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.434s · 31.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.8s · import 0.402s · 32MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

check
✓ from pytest_check import check
✗ import pytest_check as check
The pattern `import pytest_check as check` for accessing helper functions (e.g., `check.equal()`) is deprecated and will be removed in a future version. Use `from pytest_check import check` or request `check` as a fixture (e.g., `def test_my_func(check):`).

This example demonstrates how to use `pytest-check` with both its `with check:` context manager for standard assertions and its direct helper functions like `check.equal()`. A normal `assert` outside of `with check:` will stop the test immediately, while checks inside the context manager or using `check.` methods will collect all failures before reporting them at the end of the test.

import httpx from pytest_check import check def test_httpx_get(): # This assert will stop the test immediately if it fails r = httpx.get('https://www.example.org/') assert r.status_code == 200 # These 'checks' will all run, collecting failures, # even if one of them fails with check: assert r.is_redirect is False with check: assert r.encoding == 'utf-8' with check: assert 'Example Domain' in r.text # pytest-check also provides helper functions for common assertions check.equal(r.status_code, 200, msg='Status code not 200')
pytest --version
Debug
Known issues
deprecatedThe import pattern `import pytest_check as check` for using helper functions (e.g., `check.equal()`, `check.is_true()`) is deprecated. While it currently works, it will be removed in a future major version without a deprecation warning being emitted.
fix
Change imports to `from pytest_check import check` or pass `check` as a fixture to your test functions (e.g., `def test_my_func(check):`).
affects: 2.x
breakingThe default behavior for displaying pseudo-tracebacks changed in version 2.x. Only the first failure per test will now include a pseudo-traceback by default (`--check-max-tb=1`). Previously, more might have been shown.
fix
If you require more pseudo-tracebacks for debugging, configure the `--check-max-tb=N` command-line option, where `N` is the desired number of tracebacks. Setting it to a large number like 1000 will show all.
affects: >=2.0.0
gotchaThe pseudo-tracebacks used by `pytest-check` for multiple failures are generated via introspection, which can be slower than standard assert tracebacks. Limiting the number of pseudo-tracebacks (via `--check-max-tb`) is a performance optimization.
fix
Be mindful of performance if `--check-max-tb` is set to a very high number in test suites with many failures. The default of 1 is chosen for speed. You can also limit the total reported failures per test with `--check-max-report=N`.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pytest_check'
The `pytest-check` library is not installed in the active Python environment or is not accessible to pytest.
fix
Install the library using pip: `pip install pytest-check`
NameError: name 'check' is not defined
The `check` object, which provides assertion functions, is injected by the `pytest-check` plugin and is only available when tests are run using `pytest`. This error occurs if you try to execute a test file directly with Python or if the plugin is not properly installed or activated.
fix
Ensure `pytest-check` is installed (`pip install pytest-check`) and run your tests using the `pytest` command (e.g., `pytest your_test_file.py`).
ImportError: cannot import name 'check' from 'pytest_check'
The `check` object, which provides assertion functions like `equal` and `check_that`, is automatically injected into test functions by the `pytest-check` plugin and is not meant to be imported directly from the `pytest_check` package.
fix
Remove the `import` statement (e.g., `from pytest_check import check`) and use `check.equal(...)` (or other `check` functions) directly within your test functions.
AttributeError: module 'pytest_check' has no attribute 'equal'
You are trying to access `check` assertion functions directly through the `pytest_check` module, but these functions are part of the `check` object injected by the plugin, not the top-level module itself.
fix
Remove `import pytest_check` and use `check.equal(...)` (or other `check` functions) directly within your test functions. The `check` object is made available implicitly by the plugin.
Upgrade
Version history
2.9.1latest on PyPI · released Aug 1, 2026
Audit
Dependencies
pytestrequiredCore testing framework that pytest-check extends.
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pytest-check — pip install pytest-check · libregistry