diff --git a/tests/fixtures/config_files/append-config.ini b/tests/fixtures/config_files/append-config.ini new file mode 100644 index 0000000..889846b --- /dev/null +++ b/tests/fixtures/config_files/append-config.ini @@ -0,0 +1,3 @@ +[flake8] +select = W,F +max-line-length = 80 diff --git a/tests/fixtures/config_files/prepend-config.ini b/tests/fixtures/config_files/prepend-config.ini new file mode 100644 index 0000000..f769e19 --- /dev/null +++ b/tests/fixtures/config_files/prepend-config.ini @@ -0,0 +1,3 @@ +[flake8] +select = E,W +max-line-length = 78 diff --git a/tests/integration/test_aggregator.py b/tests/integration/test_aggregator.py index d3beca2..e4845a2 100644 --- a/tests/integration/test_aggregator.py +++ b/tests/integration/test_aggregator.py @@ -14,6 +14,8 @@ CLI_SPECIFIED_CONFIG = 'tests/fixtures/config_files/cli-specified.ini' USER_CONFIG = 'tests/fixtures/config_files/user-config.ini' LOCAL_CONFIG = 'tests/fixtures/config_files/local-config.ini' MISSING_CONFIG = 'tests/fixtures/config_files/missing.ini' +PREPEND_CONFIG = 'tests/fixtures/config_files/prepend-config.ini' +APPEND_CONFIG = 'tests/fixtures/config_files/append-config.ini' @pytest.fixture @@ -73,6 +75,56 @@ def mock_config_finder(program='flake8', arguments=[], "ignore": set(defaults.IGNORE), "max_line_length": 79, }), + # Correct values with prepend config only + ({'prepend_configs': [PREPEND_CONFIG]}, { + "select": {'E', 'W'}, + "ignore": set(defaults.IGNORE), + "max_line_length": 78, + }), + # Correct values with append config only + ({'append_configs': [APPEND_CONFIG]}, { + "select": {'W', 'F'}, + "ignore": set(defaults.IGNORE), + "max_line_length": 80, + }), + # Correct values with user and prepend configs + ({ + 'user_config': USER_CONFIG, + 'prepend_configs': [PREPEND_CONFIG] + }, { + "select": {'E', 'W'}, + "ignore": ['D203'], + "max_line_length": 78, + }), + # Correct values with prepend and local configs + ({ + 'prepend_configs': [PREPEND_CONFIG], + 'local_configs': [LOCAL_CONFIG] + }, { + "select": {'E', 'W', 'F'}, + "ignore": set(defaults.IGNORE), + "max_line_length": 78, + }), + # Correct values with prepend and append configs + ({ + 'prepend_configs': [PREPEND_CONFIG], + 'append_configs': [APPEND_CONFIG] + }, { + "select": {'W', 'F'}, + "ignore": set(defaults.IGNORE), + "max_line_length": 80, + }), + # Correct values with user, append, local and prepend configs + ({ + 'user_config': USER_CONFIG, + 'prepend_configs': [PREPEND_CONFIG], + 'local_configs': [LOCAL_CONFIG], + 'append_configs': [APPEND_CONFIG], + }, { + "select": {'W', 'F'}, + "ignore": ['D203'], + "max_line_length": 80, + }), ]) def test_aggregate_options_resulting_values( optmanager, config_finder_params, options_assertions