skillfed

pytest-beartype-tests

Pytest plugin that applies @beartype to every collected test function.

pytest-beartype-tests v2026.4.26 139.9K downloads/30d#11,285 on PyPI2
Permissive 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) Active released

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-tests

uv

uv add pytest-beartype-tests

poetry

poetry add pytest-beartype-tests

Installing 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

Development Status :: 4 - BetaFramework :: PytestLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

pytest type checking pluginruntime type validation testsbeartype pytest integrationtest function type enforcementpytest type annotations
type-checkingpytest-plugintesting-tools

More Testing packages