diff options
Diffstat (limited to 'coverage/tomlconfig.py')
-rw-r--r-- | coverage/tomlconfig.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/coverage/tomlconfig.py b/coverage/tomlconfig.py index 0b5052b4..49282e92 100644 --- a/coverage/tomlconfig.py +++ b/coverage/tomlconfig.py @@ -3,7 +3,6 @@ """TOML configuration support for coverage.py""" -import configparser import os import re @@ -78,8 +77,6 @@ class TomlConfigParser: """ prefixes = ["tool.coverage."] - if self.our_file: - prefixes.append("") for prefix in prefixes: real_section = prefix + section parts = real_section.split(".") @@ -98,11 +95,11 @@ class TomlConfigParser: """Like .get, but returns the real section name and the value.""" name, data = self._get_section(section) if data is None: - raise configparser.NoSectionError(section) + raise ConfigError(f"No section: {section!r}") try: value = data[option] - except KeyError as exc: - raise configparser.NoOptionError(option, name) from exc + except KeyError: + raise ConfigError(f"No option {option!r} in section: {name!r}") from None return name, value def _get_single(self, section, option): @@ -129,7 +126,7 @@ class TomlConfigParser: def options(self, section): _, data = self._get_section(section) if data is None: - raise configparser.NoSectionError(section) + raise ConfigError(f"No section: {section!r}") return list(data.keys()) def get_section(self, section): |