mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
Add tests for generate_possible_local_config_files
Fix a bug found via testing where we traverse all the way to the root directory looking for config files.
This commit is contained in:
parent
dd46f02b58
commit
949d3e48fe
2 changed files with 27 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ class ConfigFileFinder(object):
|
|||
# List of filenames to find in the local/project directory
|
||||
self.project_filenames = ('setup.cfg', 'tox.ini', self.program_config)
|
||||
|
||||
self.local_directory = os.curdir
|
||||
self.local_directory = os.path.abspath(os.curdir)
|
||||
|
||||
if not args:
|
||||
args = ['.']
|
||||
|
|
@ -66,11 +66,14 @@ class ConfigFileFinder(object):
|
|||
"""Find and generate all local config files."""
|
||||
tail = self.tail
|
||||
parent = self.parent
|
||||
local_dir = self.local_directory
|
||||
while tail:
|
||||
for project_filename in self.project_filenames:
|
||||
filename = os.path.abspath(os.path.join(parent,
|
||||
project_filename))
|
||||
yield filename
|
||||
if parent == local_dir:
|
||||
break
|
||||
(parent, tail) = os.path.split(parent)
|
||||
|
||||
def local_config_files(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue