Skip to main content

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_orghttps://dbader.orgmail@dbader.org

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

Release files for pytest-mypy 1.0.1

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.0.1
File Size Uploaded
pytest_mypy-1.0.1.tar.gz 16.0 kB Details

Built distribution (wheel)

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

Total release size:24.7 kB

Release files / pytest_mypy-1.0.1.tar.gz

Download URL pytest_mypy-1.0.1.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3f5fcaff75c80dccc6b68cf5ecc28e1bbe71e95309469eb7a28bf408ce55c074
BLAKE2b-256 checksum
How to use checksums
b0503ce149b469e27848c1dc354553b17774f9dde0140625f5a4130bd21e1052
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

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

Download URL pytest_mypy-1.0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad7133c9b92c802e032f2596590ebede7eea7c418e61d60d5cdd571b55c72056
BLAKE2b-256 checksum
How to use checksums
bf9325ed3c02e15c4ef1b04cbda7c708ffc5da755986aaacfb48db1f9e84a996
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.1

2 release files

0.1.0

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