eric7/DebugClients/Python/coverage/config.py

branch
eric7
changeset 8929
fcca2fa618bf
parent 8775
0802ae193343
child 8991
2fc945191992
diff -r d856023fbeb0 -r fcca2fa618bf eric7/DebugClients/Python/coverage/config.py
--- a/eric7/DebugClients/Python/coverage/config.py	Sun Jan 16 20:28:42 2022 +0100
+++ b/eric7/DebugClients/Python/coverage/config.py	Sat Jan 22 14:44:56 2022 +0100
@@ -10,7 +10,7 @@
 import os.path
 import re
 
-from coverage.exceptions import CoverageException
+from coverage.exceptions import ConfigError
 from coverage.misc import contract, isolate_module, substitute_variables
 
 from coverage.tomlconfig import TomlConfigParser, TomlDecodeError
@@ -59,7 +59,7 @@
             real_section = section_prefix + section
             if configparser.RawConfigParser.has_section(self, real_section):
                 return configparser.RawConfigParser.options(self, real_section)
-        raise configparser.NoSectionError(section)
+        raise ConfigError(f"No section: {section!r}")
 
     def get_section(self, section):
         """Get the contents of a section, as a dictionary."""
@@ -83,7 +83,7 @@
             if configparser.RawConfigParser.has_option(self, real_section, option):
                 break
         else:
-            raise configparser.NoOptionError(option, section)
+            raise ConfigError(f"No option {option!r} in section: {section!r}")
 
         v = configparser.RawConfigParser.get(self, real_section, option, *args, **kwargs)
         v = substitute_variables(v, os.environ)
@@ -123,7 +123,7 @@
             try:
                 re.compile(value)
             except re.error as e:
-                raise CoverageException(
+                raise ConfigError(
                     f"Invalid [{section}].{option} value {value!r}: {e}"
                 ) from e
             if value:
@@ -233,11 +233,11 @@
         # Options for plugins
         self.plugin_options = {}
 
-    MUST_BE_LIST = [
+    MUST_BE_LIST = {
         "debug", "concurrency", "plugins",
         "report_omit", "report_include",
         "run_omit", "run_include",
-    ]
+    }
 
     def from_args(self, **kwargs):
         """Read config values from `kwargs`."""
@@ -272,7 +272,7 @@
         try:
             files_read = cp.read(filename)
         except (configparser.Error, TomlDecodeError) as err:
-            raise CoverageException(f"Couldn't read config file {filename}: {err}") from err
+            raise ConfigError(f"Couldn't read config file {filename}: {err}") from err
         if not files_read:
             return False
 
@@ -285,7 +285,7 @@
                 if was_set:
                     any_set = True
         except ValueError as err:
-            raise CoverageException(f"Couldn't read config file {filename}: {err}") from err
+            raise ConfigError(f"Couldn't read config file {filename}: {err}") from err
 
         # Check that there are no unrecognized options.
         all_options = collections.defaultdict(set)
@@ -334,6 +334,8 @@
         """Return a copy of the configuration."""
         return copy.deepcopy(self)
 
+    CONCURRENCY_CHOICES = {"thread", "gevent", "greenlet", "eventlet", "multiprocessing"}
+
     CONFIG_FILE_OPTIONS = [
         # These are *args for _set_attr_from_config_option:
         #   (attr, where, type_="")
@@ -443,7 +445,7 @@
             return
 
         # If we get here, we didn't find the option.
-        raise CoverageException(f"No such option: {option_name!r}")
+        raise ConfigError(f"No such option: {option_name!r}")
 
     def get_option(self, option_name):
         """Get an option from the configuration.
@@ -471,7 +473,7 @@
             return self.plugin_options.get(plugin_name, {}).get(key)
 
         # If we get here, we didn't find the option.
-        raise CoverageException(f"No such option: {option_name!r}")
+        raise ConfigError(f"No such option: {option_name!r}")
 
     def post_process_file(self, path):
         """Make final adjustments to a file path to make it usable."""
@@ -546,7 +548,7 @@
             if config_read:
                 break
             if specified_file:
-                raise CoverageException(f"Couldn't read {fname!r} as a config file")
+                raise ConfigError(f"Couldn't read {fname!r} as a config file")
 
     # $set_env.py: COVERAGE_DEBUG - Options for --debug.
     # 3) from environment variables:

eric ide

mercurial