Skip to main content
See Build Status on Travis CI See Latest Release on PyPI

Mypy static type checker plugin for Pytest


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

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

Development Environment Setup

Here’s how to install pytest-mypy in development mode so you can test your changes locally:

$ pyvenv venv
$ source venv/bin/activate
$ python setup.py develop
$ venv/bin/py.test --mypy example_test.py

How to publish a new version to PyPI

$ pip install twine wheel
$ python setup.py sdist bdist_wheel
$ twine upload dist/*

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/dbader/pytest-mypy

Metadata

Release files for pytest-mypyd 0.3.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 pytest-mypyd 0.3.5
File Size Uploaded
pytest-mypyd-0.3.5.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-mypyd 0.3.5
File Interpreter ABI Platform
pytest_mypyd-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / pytest-mypyd-0.3.5.tar.gz

Download URL pytest-mypyd-0.3.5.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
811e4f979633e59fb240e402f688a966523621c6f0078e2324bd368475917230
BLAKE2b-256 checksum
How to use checksums
4a58c3eca0b9a2fc52b2b1f6d6b06730d2f76f716a420230bef5bfb28b75ed01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

Release files / pytest_mypyd-0.3.5-py3-none-any.whl

Download URL pytest_mypyd-0.3.5-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea02b6b6ea01c30ec08d16440a3932ffee2ec012f2e3603e534237bae95a1d32
BLAKE2b-256 checksum
How to use checksums
5793e12ec82f260ab70c042734fbc911b2be1d6f7d92810fa431c356f54ba6a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

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