mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
Start testing ConfigFileFinder.local_config_files
Make sure extra_config_files are all absolute paths and filter them in local_config_files to ensure they exist.
This commit is contained in:
parent
fdff0f705e
commit
b8dfc9a8e2
2 changed files with 42 additions and 3 deletions
|
|
@ -67,3 +67,27 @@ def test_generate_possible_local_config_files(args, expected):
|
|||
|
||||
assert (list(finder.generate_possible_local_config_files()) ==
|
||||
expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('args,extra_config_files,expected', [
|
||||
# No arguments, common prefix of abspath('.')
|
||||
([],
|
||||
[],
|
||||
[os.path.abspath('setup.cfg'),
|
||||
os.path.abspath('tox.ini')]),
|
||||
# Common prefix of "flake8/"
|
||||
(['flake8/options', 'flake8/'],
|
||||
[],
|
||||
[os.path.abspath('setup.cfg'),
|
||||
os.path.abspath('tox.ini')]),
|
||||
# Common prefix of "flake8/options"
|
||||
(['flake8/options', 'flake8/options/sub'],
|
||||
[],
|
||||
[os.path.abspath('setup.cfg'),
|
||||
os.path.abspath('tox.ini')]),
|
||||
])
|
||||
def test_local_config_files(args, extra_config_files, expected):
|
||||
"""Verify discovery of local config files."""
|
||||
finder = config.ConfigFileFinder('flake8', args, extra_config_files)
|
||||
|
||||
assert list(finder.local_config_files()) == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue