summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-10-01 08:48:18 +0200
committerEric N. Vander Weele <ericvw@gmail.com>2019-10-01 08:48:18 +0200
commit55ef2c6f5eae1617dcbbb51636e9280aa8870e02 (patch)
tree10b28fe17c309caa070773131d2ed149d0595949 /tests/unit
parent6043e908552cd38a75098c99a739497744170e81 (diff)
downloadflake8-55ef2c6f5eae1617dcbbb51636e9280aa8870e02.tar.gz
application: Pass returned prelim options to `.configure_logging()`
The verbosity and output file options can be obtained from options returned by `.parse_preliminary_options_and_args()`, instead of state from the `Application` object.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_legacy_api.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/unit/test_legacy_api.py b/tests/unit/test_legacy_api.py
index 1d6a3e2..e71d89a 100644
--- a/tests/unit/test_legacy_api.py
+++ b/tests/unit/test_legacy_api.py
@@ -1,4 +1,6 @@
"""Tests for Flake8's legacy API."""
+import argparse
+
import mock
import pytest
@@ -8,9 +10,16 @@ from flake8.formatting import base as formatter
def test_get_style_guide():
"""Verify the methods called on our internal Application."""
+ prelim_opts = argparse.Namespace(
+ output_file=None,
+ verbose=0,
+ )
mockedapp = mock.Mock()
- mockedapp.prelim_opts.verbose = 0
- mockedapp.prelim_opts.output_file = None
+ mockedapp.prelim_opts = prelim_opts
+ mockedapp.parse_preliminary_options_and_args.return_value = (
+ prelim_opts,
+ [],
+ )
with mock.patch('flake8.main.application.Application') as application:
application.return_value = mockedapp
style_guide = api.get_style_guide()