Skip to main content

Build Status

mypy-pytest-parametrize

Check pytest.mark.parametrize values against test annotations.

For example, this plugin reports the float passed to a parameter annotated as int:

"""Showcase errors in pytest parametrized values."""

import pytest


@pytest.mark.parametrize(
    argnames="arg",
    argvalues=[
        123,
        456.789,  # type: ignore[pytest-parametrize]
    ],
)
def test_foo(arg: int) -> None:
    """Check a parametrized integer."""
    assert arg > 0

Why?

pytest accepts parametrized values without checking them against the test’s annotations. This plugin lets mypy find incompatible values before the tests run. It supports multiple parameters, stacked decorators, and inline pytest.param calls.

Installation

pip install "git+https://github.com/adamtheturtle/mypy-pytest-parametrize.git"

This is tested on Python 3.11+ with mypy 2.4 and pytest 9.1+. The package has not yet been published to PyPI.

Configure mypy to use the plugin

Add the plugin to your mypy configuration file:

pyproject.toml:

[tool.mypy]

plugins = [
    "mypy_pytest_parametrize",
]

mypy.ini, .mypy.ini, or setup.cfg:

[mypy]
plugins = mypy_pytest_parametrize

Indirect fixtures and static limits

indirect=True is excluded because its values are fixture inputs, rather than the values received by the test. With indirect=["fixture_name"], the other parameters are still checked.

Parameter names and fixture routing determined at runtime are not checked. Stored decorator objects and class-level parametrization are also excluded. Stored pytest.param objects and starred values within a row are also skipped when their individual types are unavailable. Values typed as Any retain mypy’s usual behavior.

The plugin follows the proposal in pytest issue #9334.

Metadata

Release files for mypy-pytest-parametrize 2026.10.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mypy-pytest-parametrize 2026.10.5
File Size Uploaded
mypy_pytest_parametrize-2026.10.5.tar.gz 27.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mypy-pytest-parametrize 2026.10.5
File Interpreter ABI Platform
mypy_pytest_parametrize-2026.10.5-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / mypy_pytest_parametrize-2026.10.5.tar.gz

Download URL mypy_pytest_parametrize-2026.10.5.tar.gz
Size 27.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a4776e5b13816a40b7677b6e9d777d8fa75f49bc08e656731235b4e66071bb74
BLAKE2b-256 checksum
How to use checksums
ae145adf231330daad6ec6e5f1c3433ec181ac554d75b3e0d4bc51a54576a371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / mypy_pytest_parametrize-2026.10.5-py3-none-any.whl

Download URL mypy_pytest_parametrize-2026.10.5-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4ac6fbae8ee9b5b4d3200d45393d322ede45bdda677030612d64bff0dfb05c0
BLAKE2b-256 checksum
How to use checksums
473e78fc9b9351a6b0dcf398bab37467b043928927caf78481d9d0bcbe1c9700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page