diff options
| author | Eric N. Vander Weele <ericvw@gmail.com> | 2020-05-18 17:12:07 -0400 |
|---|---|---|
| committer | Eric N. Vander Weele <ericvw@gmail.com> | 2020-05-18 17:23:08 -0400 |
| commit | 563220b711a294a90472c49a795bc5eb0dbce93a (patch) | |
| tree | 79aeb8408f5ac607fa8858ae2c92b7a54f0661cf /tests | |
| parent | 8be5a7294bcdc40248e483b8a1ca734471179eda (diff) | |
| download | flake8-563220b711a294a90472c49a795bc5eb0dbce93a.tar.gz | |
config: Normalize paths in CLI-specified config relative to config dir
Paths specified in configuration files should be relative to the
directory where the configuration file resides. Formerly, paths were
normalized relative to the current working directory where `flake8` was
invoked. The former behavior was not expected, especially for directory
structures with subprojects each having their own configuration.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_merged_config_parser.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/unit/test_merged_config_parser.py b/tests/unit/test_merged_config_parser.py index 41885e4..d446ad8 100644 --- a/tests/unit/test_merged_config_parser.py +++ b/tests/unit/test_merged_config_parser.py @@ -31,15 +31,16 @@ def test_parse_cli_config(optmanager, config_finder): action='count') parser = config.MergedConfigParser(optmanager, config_finder) - parsed_config = parser.parse_cli_config( - 'tests/fixtures/config_files/cli-specified.ini' - ) + config_file = 'tests/fixtures/config_files/cli-specified.ini' + parsed_config = parser.parse_cli_config(config_file) + + config_dir = os.path.dirname(config_file) assert parsed_config == { 'ignore': ['E123', 'W234', 'E111'], 'exclude': [ - os.path.abspath('foo/'), - os.path.abspath('bar/'), - os.path.abspath('bogus/'), + os.path.abspath(os.path.join(config_dir, 'foo/')), + os.path.abspath(os.path.join(config_dir, 'bar/')), + os.path.abspath(os.path.join(config_dir, 'bogus/')), ], 'quiet': 1, } |
