Merge "Use mypy to do static type checking" into feature/zuulv3

This commit is contained in:
Jenkins 2017-07-28 03:58:32 +00:00 committed by Gerrit Code Review
commit 6d9385829b
65 changed files with 13 additions and 5 deletions

View File

@ -14,3 +14,4 @@ sphinxcontrib-programoutput
oslosphinx oslosphinx
mock mock
PyMySQL PyMySQL
mypy

View File

@ -27,8 +27,12 @@ deps = bindep
commands = bindep test commands = bindep test
[testenv:pep8] [testenv:pep8]
# streamer is python3 only, so we need to run flake8 in python3 # --ignore-missing-imports tells mypy to not try to follow imported modules
commands = flake8 {posargs} # out of the current tree. As you might expect, we don't want to run static
# type checking on the world - just on ourselves.
commands =
flake8 {posargs}
mypy --ignore-missing-imports zuul
[testenv:cover] [testenv:cover]
commands = commands =

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -33,7 +33,7 @@ class Driver(object, metaclass=abc.ABCMeta):
The class or instance attribute **name** must be provided as a string. The class or instance attribute **name** must be provided as a string.
""" """
name = None name = None # type: str
def reconfigure(self, tenant): def reconfigure(self, tenant):
"""Called when a tenant is reconfigured. """Called when a tenant is reconfigured.

View File

@ -23,6 +23,8 @@ import shlex
import subprocess import subprocess
import sys import sys
from typing import Dict, List # flake8: noqa
from zuul.driver import (Driver, WrapperInterface) from zuul.driver import (Driver, WrapperInterface)
@ -70,7 +72,7 @@ class BubblewrapDriver(Driver, WrapperInterface):
name = 'bubblewrap' name = 'bubblewrap'
log = logging.getLogger("zuul.BubblewrapDriver") log = logging.getLogger("zuul.BubblewrapDriver")
mounts_map = {'rw': [], 'ro': []} mounts_map = {'rw': [], 'ro': []} # type: Dict[str, List]
def __init__(self): def __init__(self):
self.bwrap_command = self._bwrap_command() self.bwrap_command = self._bwrap_command()

View File

@ -13,7 +13,8 @@ import yaml
from yaml import YAMLObject, YAMLError # noqa: F401 from yaml import YAMLObject, YAMLError # noqa: F401
try: try:
from yaml import cyaml # Explicit type ignore to deal with provisional import failure
from yaml import cyaml # type: ignore
import _yaml import _yaml
SafeLoader = cyaml.CSafeLoader SafeLoader = cyaml.CSafeLoader
SafeDumper = cyaml.CSafeDumper SafeDumper = cyaml.CSafeDumper