Add rudimentary mypy type checking

Add a very lax mypy configuration, add it to tox -e linting, and
fix/ignore the few errors that come up. The idea is to get it running
before diving in too much.

This enables:

- Progressively adding type annotations and enabling more strict
  options, which will improve the codebase (IMO).

- Annotating the public API in-line, and eventually exposing it to
  library users who use type checkers (with a py.typed file).

Though, none of this is done yet.

Refs https://github.com/pytest-dev/pytest/issues/3342.
This commit is contained in:
Ran Benita
2019-07-08 10:04:19 +03:00
committed by Anthony Sottile
parent 628ff4d619
commit 89dfde9535
30 changed files with 104 additions and 45 deletions

View File

@@ -265,7 +265,8 @@ class TestRaises:
"""Test current behavior with regard to exceptions via __class__ (#4284)."""
class CrappyClass(Exception):
@property
# Type ignored because it's bypassed intentionally.
@property # type: ignore
def __class__(self):
assert False, "via __class__"