summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-12-29 17:22:26 -0500
committerEric N. Vander Weele <ericvw@gmail.com>2019-12-29 18:07:51 -0500
commit7f9f70064c50bbb6024fafed4568e0693f5640b5 (patch)
treea81485499d227115c26d3fadf3ed42302d67f413 /tests/integration
parentbb61b3df82a938f7cd1ca32daab4a31e4586b281 (diff)
downloadflake8-7f9f70064c50bbb6024fafed4568e0693f5640b5.tar.gz
aggregator: Forward --config and --isolated options during aggregation
This fixes a regression introduced in !346 to ensure that `--config` and `--isolated` are recognized in `aggregate_options()`. The regression manifested because `aggregate_options()` was relying on re-parsing `argv` to obtain the option values. However, !346 changed the preliminary parsing logic to only parse and "eat" what is necessary and forward along the options needed before all the configuration was loaded. This code path was overlooked because the tests in `test_aggregator()` were passing but the call from the `Application` object would never have these options in the remaining `argv` list to be passed long.
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_aggregator.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/integration/test_aggregator.py b/tests/integration/test_aggregator.py
index d2c0133..18ce5e8 100644
--- a/tests/integration/test_aggregator.py
+++ b/tests/integration/test_aggregator.py
@@ -28,13 +28,12 @@ def optmanager():
def test_aggregate_options_with_config(optmanager):
"""Verify we aggregate options and config values appropriately."""
- arguments = ['flake8', '--config', CLI_SPECIFIED_CONFIG, '--select',
+ arguments = ['flake8', '--select',
'E11,E34,E402,W,F', '--exclude', 'tests/*']
config_finder = config.ConfigFileFinder('flake8', [])
options, args = aggregator.aggregate_options(
- optmanager, config_finder, arguments)
+ optmanager, config_finder, CLI_SPECIFIED_CONFIG, False, arguments)
- assert options.config == CLI_SPECIFIED_CONFIG
assert options.select == ['E11', 'E34', 'E402', 'W', 'F']
assert options.ignore == ['E123', 'W234', 'E111']
assert options.exclude == [os.path.abspath('tests/*')]
@@ -42,14 +41,13 @@ def test_aggregate_options_with_config(optmanager):
def test_aggregate_options_when_isolated(optmanager):
"""Verify we aggregate options and config values appropriately."""
- arguments = ['flake8', '--isolated', '--select', 'E11,E34,E402,W,F',
+ arguments = ['flake8', '--select', 'E11,E34,E402,W,F',
'--exclude', 'tests/*']
config_finder = config.ConfigFileFinder('flake8', [])
optmanager.extend_default_ignore(['E8'])
options, args = aggregator.aggregate_options(
- optmanager, config_finder, arguments)
+ optmanager, config_finder, None, True, arguments)
- assert options.isolated is True
assert options.select == ['E11', 'E34', 'E402', 'W', 'F']
assert sorted(options.ignore) == [
'E121', 'E123', 'E126', 'E226', 'E24', 'E704', 'E8', 'W503', 'W504',