pytest-beartype-tests
Pytest plugin that applies @beartype to every collected test function.
What it is and what it does
pytest-beartype-tests is a minimal pytest plugin that wraps every collected test function with beartype's runtime type-checking decorator. It catches type violations in test signatures and any locally-typed variables inside test bodies at runtime, without requiring manual decorator application to each test.
The plugin auto-registers via pytest's entry point system and requires no configuration. It is explicitly positioned as a temporary workaround until pytest-beartype 0.3.0 is released with native support for this functionality. The package depends on beartype and pytest, both of which are standard in Python testing workflows.
Use it for:
- Catch type mismatches in test function parameters before test logic runs, surfacing contract violations early.
- Validate locally-typed variables within test bodies to ensure test code itself respects its own type hints.
- Add runtime type safety to test suites without manually decorating every test function with @beartype.
- Detect when test fixtures or parametrized inputs violate expected types before assertions are evaluated.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that automatically applies runtime type-checking via beartype to every collected test function, catching type violations in test signatures and locally-typed variables during test execution.
Yes, if you want automatic runtime type-checking on test functions with minimal setup. Install friction is low and the plugin is actively maintained. However, be aware this is a temporary workaround for functionality expected in pytest-beartype 0.3.0—plan to migrate when that release arrives. The project is very new with minimal adoption, so edge cases may not be well-tested.
Install
pytest-beartype-tests on PyPI
pip
pip install pytest-beartype-testsuv
uv add pytest-beartype-testspoetry
poetry add pytest-beartype-testsInstalling pytest-beartype-tests
Before you install
Low install friction with only two runtime dependencies (beartype and pytest). Active maintenance with a recent commit on 2026-08-13, though the project is new (first release 2026-04-19) and has minimal adoption signals (2 stars).
License in practice
MIT License permits unrestricted use, modification, and distribution with only attribution required—no restrictions on commercial or proprietary use.
Quickstart
# Install
pip install pytest-beartype-tests
# In your test file, just write normally with type hints:
def test_example(x: int) -> None:
assert x > 0
# Run pytest; the plugin auto-registers and applies beartype to all test functions
pytest test_example.py
Requires Python 3.11 or later; the plugin auto-registers via pytest11 entry point with no configuration needed.
Verify before relying
- Whether the plugin works with pytest fixtures and parameterized tests beyond basic function signatures.
- Performance overhead of applying beartype to every test function in large test suites.
- Compatibility with other pytest plugins that also modify test collection or execution.
- Whether this plugin will be superseded by pytest-beartype 0.3.0 as documented, and on what timeline.
Package facts
| License | MIT License Copyright (c) 2026 Adam Dangoor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — beartype, pytest |
| Maintenance | actively maintained — 110 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 139,866/month — #11,285 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_beartype_tests-2026.4.26-py3-none-any.whl
Keywords: beartype, pytest, type-checking
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
beartypeBeartype is a runtime type checker that…
permissive · top 1,000 on PyPI
PyTestArchPyTestArch lets you define and test…
permissive · top 15,000 on PyPI
pytest-item-dictA pytest plugin that builds hierarchical…
unclear · top 15,000 on PyPI
pytest-describeA pytest plugin that organizes tests into…
permissive · top 5,000 on PyPI
pytest-retrypytest-retry is a pytest plugin that…
permissive · top 5,000 on PyPI
pytest-jsonA pytest plugin that generates JSON reports of…
permissive · top 15,000 on PyPI
pytest-cacheA pytest plugin that persists test state across…
permissive · top 15,000 on PyPI
pytest-isortA pytest plugin that automatically checks…
permissive · top 15,000 on PyPI
pytest-json-reportA pytest plugin that generates JSON-formatted…
permissive · top 5,000 on PyPI
MonkeyTypeMonkeyType collects runtime types of function…
permissive · top 15,000 on PyPI