Skip to main content

A Pytest Plugin for Mypy

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_mypy-1.0.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

pytest_mypy-1.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_mypy-1.0.1.tar.gz.

File metadata

  • Download URL: pytest_mypy-1.0.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for pytest_mypy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3f5fcaff75c80dccc6b68cf5ecc28e1bbe71e95309469eb7a28bf408ce55c074
MD5 f49078e300c3c9a542ec0881255cc844
BLAKE2b-256 b0503ce149b469e27848c1dc354553b17774f9dde0140625f5a4130bd21e1052

See more details on using hashes here.

File details

Details for the file pytest_mypy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_mypy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for pytest_mypy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad7133c9b92c802e032f2596590ebede7eea7c418e61d60d5cdd571b55c72056
MD5 663a78eefd05db1dad62835b2292972a
BLAKE2b-256 bf9325ed3c02e15c4ef1b04cbda7c708ffc5da755986aaacfb48db1f9e84a996

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page