Merge branch 'make_notifier_gone' into 'master'

Fix legacy api invocation of make_notifier

Closes #497

See merge request pycqa/flake8!293
This commit is contained in:
Anthony Sottile 2019-01-30 19:06:24 +00:00
commit 077b640a86
3 changed files with 13 additions and 2 deletions

View file

@ -46,7 +46,6 @@ def get_style_guide(**kwargs):
except AttributeError:
LOG.error('Could not update option "%s"', key)
application.make_formatter()
application.make_notifier()
application.make_guide()
application.make_file_checker_manager()
return StyleGuide(application)

View file

@ -0,0 +1,13 @@
"""Integration tests for the legacy api."""
from flake8.api import legacy
def test_legacy_api(tmpdir):
"""A basic end-to-end test for the legacy api reporting errors."""
with tmpdir.as_cwd():
t_py = tmpdir.join('t.py')
t_py.write('import os # unused import\n')
style_guide = legacy.get_style_guide()
report = style_guide.check_files([t_py.strpath])
assert report.total_errors == 1

View file

@ -22,7 +22,6 @@ def test_get_style_guide():
mockedapp.register_plugin_options.assert_called_once_with()
mockedapp.parse_configuration_and_cli.assert_called_once_with([])
mockedapp.make_formatter.assert_called_once_with()
mockedapp.make_notifier.assert_called_once_with()
mockedapp.make_guide.assert_called_once_with()
mockedapp.make_file_checker_manager.assert_called_once_with()
assert isinstance(style_guide, api.StyleGuide)