Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/realpython/pytest-mypy
Mypy static type checker plugin for Pytest
https://github.com/realpython/pytest-mypy
Last synced: 18 days ago
JSON representation
Mypy static type checker plugin for Pytest
- Host: GitHub
- URL: https://github.com/realpython/pytest-mypy
- Owner: realpython
- License: mit
- Created: 2016-09-29T14:39:23.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T22:01:39.000Z (9 months ago)
- Last Synced: 2024-05-19T05:01:41.038Z (7 months ago)
- Language: Python
- Homepage: https://pypi.org/project/pytest-mypy/
- Size: 277 KB
- Stars: 244
- Watchers: 9
- Forks: 32
- Open Issues: 11
-
Metadata Files:
- Readme: README.rst
- Changelog: changelog.md
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
- best-of-python-dev - GitHub - 15% open · ⏱️ 12.03.2024): (Testing Tools)
README
pytest-mypy
===================================Mypy static type checker plugin for pytest
.. image:: https://img.shields.io/pypi/v/pytest-mypy.svg
:target: https://pypi.org/project/pytest-mypy/
:alt: See Latest Release on PyPIFeatures
--------* 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`_:
.. code-block:: bash
$ pip install pytest-mypy
Usage
-----You can enable pytest-mypy with the ``--mypy`` flag:
.. code-block:: bash
$ 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:.. code-block:: python
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:
.. code-block:: bash
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 – [email protected]
https://github.com/realpython/pytest-mypy
.. _`MIT`: http://opensource.org/licenses/MIT
.. _`file an issue`: https://github.com/realpython/pytest-mypy/issues
.. _`pip`: https://pypi.python.org/pypi/pip/
.. _`PyPI`: https://pypi.python.org/pypi
.. _`mypy`: http://mypy-lang.org/
.. _`pytest-flake8`: https://pypi.python.org/pypi/pytest-flake8
.. _`flake8`: https://pypi.python.org/pypi/flake8
.. _`@dbader_org`: https://twitter.com/dbader_org