summaryrefslogtreecommitdiff
path: root/tox.ini
diff options
context:
space:
mode:
authorChris Patterson <cpatterson@microsoft.com>2022-02-14 12:09:01 -0500
committerGitHub <noreply@github.com>2022-02-14 11:09:01 -0600
commit9ba3ca6ce5013207737e431f52735c7eda3a2fbb (patch)
tree3f240e45f3c2f7d5954234738cd3a92cdecd2417 /tox.ini
parent470b4a574514cf87f90682ac2bdd71b5fbbe6139 (diff)
downloadcloud-init-git-9ba3ca6ce5013207737e431f52735c7eda3a2fbb.tar.gz
mypy: introduce type checking (#1254)
All currently failing modules are excluded from reporting errors using follow-imports=silent and an exclusion list. Future work can whittle down this failing list. This change will start enforcing new modules and those currently passing. Includes some minor alphabetical reordering in tox.ini. Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Diffstat (limited to 'tox.ini')
-rw-r--r--tox.ini38
1 files changed, 32 insertions, 6 deletions
diff --git a/tox.ini b/tox.ini
index aab6d4d4..c494cb94 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py3, lowest-supported-dev, flake8, pylint, black, isort
+envlist = py3, lowest-supported-dev, black, flake8, isort, mypy, pylint
recreate = True
[testenv]
@@ -10,10 +10,15 @@ passenv=
PYTEST_ADDOPTS
[format_deps]
-flake8==3.9.2
-pylint==2.11.1
black==21.12b0
+flake8==3.9.2
isort==5.10.1
+mypy==0.931
+pylint==2.11.1
+pytest==7.0.0
+types-PyYAML==6.0.4
+types-requests==2.27.8
+types-setuptools==57.4.9
[testenv:flake8]
deps =
@@ -37,18 +42,30 @@ deps =
isort=={[format_deps]isort}
commands = {envpython} -m isort . --check-only
+[testenv:mypy]
+deps =
+ mypy=={[format_deps]mypy}
+ types-pyyaml=={[format_deps]types-PyYAML}
+ types-requests=={[format_deps]types-requests}
+ types-setuptools=={[format_deps]types-setuptools}
+ pytest=={[format_deps]pytest}
+commands = {envpython} -m mypy .
+
[testenv:check_format]
deps =
- flake8=={[format_deps]flake8}
- pylint=={[format_deps]pylint}
black=={[format_deps]black}
+ flake8=={[format_deps]flake8}
isort=={[format_deps]isort}
+ mypy=={[format_deps]mypy}
+ pylint=={[format_deps]pylint}
+ pytest=={[format_deps]pytest}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
commands =
{[testenv:black]commands}
- {[testenv:isort]commands}
{[testenv:flake8]commands}
+ {[testenv:isort]commands}
+ {[testenv:mypy]commands}
{[testenv:pylint]commands}
[testenv:do_format]
@@ -122,6 +139,15 @@ commands =
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}
deps = flake8
+[testenv:tip-mypy]
+commands = {envpython} -m mypy --install-types --non-interactive .
+deps =
+ mypy
+ pytest
+ types-PyYAML
+ types-requests
+ types-setuptools
+
[testenv:tip-pylint]
commands = {envpython} -m pylint {posargs:cloudinit tests tools}
deps =