From ede2dcf4c23fee30a1970a564c33ba384fdf07b8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 29 Oct 2019 12:10:32 +0100 Subject: [PATCH] Run mypy over tests as well Rationale: https://twitter.com/codewithanthony/status/1188958327318794241 --- mypy.ini | 8 ++++++++ tests/conftest.py | 4 ++-- tox.ini | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 0d09918a0..eaa349e26 100644 --- a/mypy.ini +++ b/mypy.ini @@ -51,6 +51,14 @@ ignore_missing_imports = True # https://github.com/python/typeshed/issues/1019 ignore_missing_imports = True +[mypy-helpers.*] +# test helpers only importable via pytest +ignore_missing_imports = True + +[mypy-pytest] +# https://github.com/pytest-dev/pytest/issues/3342 +ignore_missing_imports = True + [mypy-qutebrowser.browser.webkit.rfc6266] # subclasses dynamic PyPEG2 classes disallow_subclassing_any = False diff --git a/tests/conftest.py b/tests/conftest.py index 22effd499..2bb7a4cda 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -87,7 +87,7 @@ def _apply_platform_markers(config, item): ('unicode_locale', sys.getfilesystemencoding() == 'ascii', "Skipped because of ASCII locale"), ('qtwebkit6021_skip', - version.qWebKitVersion and + version.qWebKitVersion and # type: ignore version.qWebKitVersion() == '602.1', "Broken on WebKit 602.1") ] @@ -211,7 +211,7 @@ def pytest_configure(config): try: # Added in sip 4.19.4 - sip.enableoverflowchecking(True) + sip.enableoverflowchecking(True) # type: ignore except AttributeError: pass diff --git a/tox.ini b/tox.ini index dc129b8ac..f47952e36 100644 --- a/tox.ini +++ b/tox.ini @@ -197,10 +197,11 @@ passenv = TERM deps = -r{toxinidir}/requirements.txt -r{toxinidir}/misc/requirements/requirements-dev.txt + -r{toxinidir}/misc/requirements/requirements-tests.txt -r{toxinidir}/misc/requirements/requirements-pyqt.txt -r{toxinidir}/misc/requirements/requirements-mypy.txt commands = - {envpython} -m mypy qutebrowser {posargs} + {envpython} -m mypy qutebrowser tests {posargs} [testenv:sphinx] basepython = {env:PYTHON:python3}