Skip to content

Commit

Permalink
Call mypy with newly added parameter flush_errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petr-muller committed Mar 5, 2018
1 parent 809d68a commit 1cac7ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pytest_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1cac7ca

Please sign in to comment.