Skip to content

Commit

Permalink
debug #1516
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Dec 27, 2022
1 parent 012a687 commit 33c83d6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions coverage/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 297,7 @@ def from_file(self, filename: str, warn: Callable[[str], None], our_file: bool)
files_read = cp.read(filename)
except (configparser.Error, TomlDecodeError) as err:
raise ConfigError(f"Couldn't read config file {filename}: {err}") from err
print(f"{files_read=}")
if not files_read:
return False

Expand All @@ -308,6 309,7 @@ def from_file(self, filename: str, warn: Callable[[str], None], our_file: bool)
was_set = self._set_attr_from_config_option(cp, *option_spec)
if was_set:
any_set = True
print(f"{any_set=} because {option_spec=}")
except ValueError as err:
raise ConfigError(f"Couldn't read config file {filename}: {err}") from err

Expand All @@ -332,20 334,24 @@ def from_file(self, filename: str, warn: Callable[[str], None], our_file: bool)
for option in cp.options('paths'):
self.paths[option] = cp.getlist('paths', option)
any_set = True
print(f"{any_set=} because paths:{option}")

# plugins can have options
for plugin in self.plugins:
if cp.has_section(plugin):
self.plugin_options[plugin] = cp.get_section(plugin)
any_set = True
print(f"{any_set=} because {plugin=}:{option}")

# Was this file used as a config file? If it's specifically our file,
# then it was used. If we're piggybacking on someone else's file,
# then it was only used if we found some settings in it.
print(f"{our_file=}")
if our_file:
used = True
else:
used = any_set
print(f"{used=}")

if used:
self.config_file = os.path.abspath(filename)
Expand Down Expand Up @@ -591,7 597,9 @@ def read_coverage_config(
files_to_try = config_files_to_try(config_file)

for fname, our_file, specified_file in files_to_try:
print(f"Reading {fname=}")
config_read = config.from_file(fname, warn, our_file=our_file)
print(f"{config_read=}")
if config_read:
break
if specified_file:
Expand Down

0 comments on commit 33c83d6

Please sign in to comment.