diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-06-25 12:01:02 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-06-25 12:01:02 -0500 |
| commit | cee691059f0a2805c644a1c3541f70e306225b48 (patch) | |
| tree | 63ae4c14f3968d8d88c398bb4cbb15d691618202 /tests/integration/test_aggregator.py | |
| parent | 93089108932a5382630243a5691d4cf796b60ec4 (diff) | |
| parent | 6eb2e3a70147baad1cc2ad3d51c269974da2320f (diff) | |
| download | flake8-3.0.0b1.tar.gz | |
Merge branch 'origin/proposed/3.0' into master3.0.0b1
Diffstat (limited to 'tests/integration/test_aggregator.py')
| -rw-r--r-- | tests/integration/test_aggregator.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/integration/test_aggregator.py b/tests/integration/test_aggregator.py new file mode 100644 index 0000000..929bdbf --- /dev/null +++ b/tests/integration/test_aggregator.py @@ -0,0 +1,48 @@ +"""Test aggregation of config files and command-line options.""" +import os + +import pytest + +from flake8.main import options +from flake8.options import aggregator +from flake8.options import manager + +CLI_SPECIFIED_CONFIG = 'tests/fixtures/config_files/cli-specified.ini' + + +@pytest.fixture +def optmanager(): + """Create a new OptionManager.""" + option_manager = manager.OptionManager( + prog='flake8', + version='3.0.0', + ) + options.register_default_options(option_manager) + return option_manager + + +def test_aggregate_options_with_config(optmanager): + """Verify we aggregate options and config values appropriately.""" + arguments = ['flake8', '--config', CLI_SPECIFIED_CONFIG, '--select', + 'E11,E34,E402,W,F', '--exclude', 'tests/*'] + options, args = aggregator.aggregate_options(optmanager, 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/*')] + + +def test_aggregate_options_when_isolated(optmanager): + """Verify we aggregate options and config values appropriately.""" + arguments = ['flake8', '--isolated', '--select', 'E11,E34,E402,W,F', + '--exclude', 'tests/*'] + optmanager.extend_default_ignore(['E8']) + options, args = aggregator.aggregate_options(optmanager, 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', + ] + assert options.exclude == [os.path.abspath('tests/*')] |
