mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-06 04:56:54 +00:00
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.
This commit is contained in:
parent
8be5a7294b
commit
563220b711
2 changed files with 8 additions and 7 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue