From 77aedd67b3473c50c262c887b9f092a57acee7ad Mon Sep 17 00:00:00 2001 From: Petr Muller Date: Mon, 5 Mar 2018 21:42:02 +0100 Subject: [PATCH 1/2] Call mypy with newly added parameter `flush_errors` Unfortunately the target function does not have any docstring in mypy, but it is typed as Optional[] which means the function should accept None as a value. Doing so seems to suppress issues reported in #6. Quick skim of the culprit PR in mypy (https://github.com/python/mypy/pull/4396/files) shows the code really counts with None being passed and adjusting appropriately, citing: > If we were not given a flush_errors, we use one that will populate > those fields for callers that want the traditional API. --- pytest_mypy.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest_mypy.py b/pytest_mypy.py index 2dd5110..7ff64f2 100644 --- a/pytest_mypy.py +++ b/pytest_mypy.py @@ -55,7 +55,7 @@ def runtest(self): sources, options = mypy.main.process_options(mypy_argv) try: - res = mypy.main.type_check_only(sources, None, options) + res = mypy.main.type_check_only(sources, None, options, flush_errors=None) errors = res.errors except mypy.errors.CompileError as e: errors = e.messages diff --git a/setup.py b/setup.py index 9a65eaf..11db44f 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def read(fname): description='Mypy static type checker plugin for Pytest', long_description=read('README.rst'), py_modules=['pytest_mypy'], - install_requires=['pytest>=2.9.2', 'mypy>=0.470'], + install_requires=['pytest>=2.9.2', 'mypy>=0.570'], classifiers=[ 'Development Status :: 4 - Beta', 'Framework :: Pytest', From 71f91373b83a83687d877b3416aa646cc02e31c8 Mon Sep 17 00:00:00 2001 From: Petr Muller Date: Mon, 5 Mar 2018 22:01:04 +0100 Subject: [PATCH 2/2] Remove Python 3.3 from supported versions Mypy itself needs Python 3.4 at least, citing it's README.md: > You need Python 3.4 or later to run mypy --- .travis.yml | 1 - setup.py | 1 - tox.ini | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ead3a97..33f6d6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false language: python python: - - "3.3" - "3.4" - "3.5" - "3.6" diff --git a/setup.py b/setup.py index 11db44f..9355596 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ def read(fname): 'Topic :: Software Development :: Testing', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', diff --git a/tox.ini b/tox.ini index d7da204..a4d711e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ # For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] -envlist = py33,py34,py35,flake8 +envlist = py34,py35,py36,flake8 [testenv] deps = pytest