From 34ecf5ab91de3316dd0dad8357843b271594f6f0 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 2 Jun 2017 16:45:41 +0100 Subject: tox: Integrate mypy mypy is an experimental optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing. While still in development, most features are supported and it's already being used by real world projects like Sphinx. Let's start small by integrating it into some of the interfaces that nova exposes. We can further build upon this if it works out. This change sets up the boilerplate necessary to use mypy in nova. Type annotations are not included for any module - these will be added separately. We're calling mypy by way of a script, as this allows us to store a list of files that we have converted while we're in the process of adding type annotations where necessary. Change-Id: I75ab46a6768c4ca2050fdde2b7f8eeb90724c8c6 Signed-off-by: Stephen Finucane --- tox.ini | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tox.ini') diff --git a/tox.ini b/tox.ini index 214a8c75f5..5402c7edab 100644 --- a/tox.ini +++ b/tox.ini @@ -38,11 +38,19 @@ commands = env TEST_OSPROFILER=1 stestr run --combine --no-discover 'nova.tests.unit.test_profiler' stestr slowest +[testenv:mypy] +description = + Run type checks. +envdir = {toxworkdir}/shared +commands = + bash tools/mypywrap.sh {posargs} + [testenv:pep8] description = Run style checks. envdir = {toxworkdir}/shared commands = + {[testenv:mypy]commands} bash tools/flake8wrap.sh {posargs} # Check that all JSON files don't have \r\n in line. bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'" -- cgit v1.2.1