Skip to main content

pytest-mypy

Mypy static type checker plugin for pytest

See Latest Release on PyPI

Features

  • Runs the mypy static type checker on your source files as part of your pytest test runs.

  • Does for mypy what the pytest-flake8 plugin does for flake8.

  • This is a work in progress – pull requests appreciated.

Installation

You can install “pytest-mypy” via pip from PyPI:

$ pip install pytest-mypy

Usage

You can enable pytest-mypy with the --mypy flag:

$ py.test --mypy test_*.py

Mypy supports reading configuration settings from a mypy.ini file. Alternatively, the plugin can be configured in a conftest.py to invoke mypy with extra options:

def pytest_configure(config):
    plugin = config.pluginmanager.getplugin('mypy')
    plugin.mypy_argv.append('--check-untyped-defs')

You can restrict your test run to only perform mypy checks and not any other tests by using the -m option:

py.test --mypy -m mypy test_*.py

License

Distributed under the terms of the MIT license, “pytest-mypy” is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Meta

Daniel Bader – @dbader_org – https://dbader.org – mail@dbader.org

https://github.com/realpython/pytest-mypy

Metadata

Release files for pytest-mypy 1.1.0

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

Source distribution (sdist)

Source distribution for pytest-mypy 1.1.0
File Size Uploaded Provenance
pytest_mypy-1.1.0.tar.gz 16.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 25.3 kB

Release files / pytest_mypy-1.1.0.tar.gz

Download URL pytest_mypy-1.1.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b9f4237c0311eec507c48986dde2d776f399c98fdb92dae5c93f96c19bcae0e4
BLAKE2b-256 checksum
How to use checksums
83c4a6970cb4cdb1e8f28220b0de998b6212fa3255a52f38b88794cdc96389cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / pytest_mypy-1.1.0-py3-none-any.whl

Download URL pytest_mypy-1.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f0e3cc7be0825188a427811a8fd0fd83afc010b0ea167a273180b81fbd7d8b5
BLAKE2b-256 checksum
How to use checksums
60830ee8e5dd1fb69b1429a251cb7b6e52882f7e14b14b01fa2a5f1d6fc141d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for pytest-mypy 1.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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