Skip to main content

Mypy static type checker plugin for Pytest

Project description

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

https://github.com/dbader/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-mypyd-0.3.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_mypyd-0.3.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-mypyd-0.3.3.tar.gz.

File metadata

  • Download URL: pytest-mypyd-0.3.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using 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.2

File hashes

Hashes for pytest-mypyd-0.3.3.tar.gz
Algorithm Hash digest
SHA256 d8e2f3ad37ff0926de330cf24c4d0c8052a5ea32e6a9ba90a237c435a540c900
MD5 27c05eeaa6aead03ad1063d3d6ffc4bc
BLAKE2b-256 b6603c329b91bcbbcd889f6c472a7ea808111eea40b7eb705de7e59f96732957

See more details on using hashes here.

File details

Details for the file pytest_mypyd-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: pytest_mypyd-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using 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.2

File hashes

Hashes for pytest_mypyd-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 72ff56132064c2e8f7ca8e39634560e58789643b299a4e7a9d329a2a88d2f4b9
MD5 9407b208f2fb5161a8c87786f7902065
BLAKE2b-256 538e4896cdbfe352f51fb5e96f5e44656ec69af844906b1608d2228af3084f7d

See more details on using hashes here.

Supported by

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