File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ def _find_config_file(path: str) -> Optional[str]:
29
29
home_stat = None
30
30
31
31
dir_stat = _stat_key (path )
32
- cfg = configparser .RawConfigParser ()
33
32
while True :
34
33
for candidate in ("setup.cfg" , "tox.ini" , ".flake8" ):
34
+ cfg = configparser .RawConfigParser ()
35
35
cfg_path = os .path .join (path , candidate )
36
36
try :
37
37
cfg .read (cfg_path , encoding = "UTF-8" )
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ def test_config_file_without_section_is_not_considered(tmp_path):
21
21
22
22
23
23
def test_config_file_with_parse_error_is_not_considered (tmp_path , caplog ):
24
- tmp_path .joinpath ("setup.cfg" ).write_text ("[error" )
24
+ # the syntax error here is deliberately to trigger a partial parse
25
+ # https://github.com/python/cpython/issues/95546
26
+ tmp_path .joinpath ("setup.cfg" ).write_text ("[flake8]\n x = 1\n ..." )
25
27
26
28
assert config ._find_config_file (str (tmp_path )) is None
27
29
You can’t perform that action at this time.
0 commit comments