Add mypy tox env

Add a "mypy" tox environment which runs mypy
type checking against Cinder code.

Taken from Stephen Finucane's Nova work at
https://review.opendev.org/#/c/676208/

Added "show_error_codes" and "pretty" options.

Generates an html report in ./mypy-report/

This adds stubs for oslo.i18n, so that _() calls
are annotated as intended.  It may be possible to
do this with less .pyi files carried along here.

Change-Id: I2589d22c1f16f2e177d34730a520591743c0c1e3
This commit is contained in:
Eric Harney
2020-05-18 16:58:16 -04:00
parent 2ce35aa94b
commit 6e53c264b6
17 changed files with 170 additions and 0 deletions

View File

@@ -169,6 +169,13 @@ deps = bindep
commands = bindep {posargs}
usedevelop = False
[testenv:mypy]
description =
Run type checks.
envdir = {toxworkdir}/pep8
commands =
bash tools/mypywrap.sh {posargs}
[flake8]
# Following checks are ignored on purpose.
#