From 137b45ac2f65b72521505da21bd8fd8c30db0743 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Wed, 30 Jan 2019 11:00:36 -0800 Subject: [PATCH] Fix legacy api invocation of make_notifier --- src/flake8/api/legacy.py | 1 - tests/integration/test_api_legacy.py | 13 +++++++++++++ tests/unit/test_legacy_api.py | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/integration/test_api_legacy.py diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py index 2a3f10b..fd06a72 100644 --- a/src/flake8/api/legacy.py +++ b/src/flake8/api/legacy.py @@ -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) diff --git a/tests/integration/test_api_legacy.py b/tests/integration/test_api_legacy.py new file mode 100644 index 0000000..0ffaa22 --- /dev/null +++ b/tests/integration/test_api_legacy.py @@ -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 diff --git a/tests/unit/test_legacy_api.py b/tests/unit/test_legacy_api.py index 3c577d6..1d6a3e2 100644 --- a/tests/unit/test_legacy_api.py +++ b/tests/unit/test_legacy_api.py @@ -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)