eric7/DebugClients/Python/coverage/control.py

branch
eric7
changeset 8929
fcca2fa618bf
parent 8775
0802ae193343
child 8991
2fc945191992
--- a/eric7/DebugClients/Python/coverage/control.py	Sun Jan 16 20:28:42 2022 +0100
+++ b/eric7/DebugClients/Python/coverage/control.py	Sat Jan 22 14:44:56 2022 +0100
@@ -21,7 +21,7 @@
 from coverage.data import CoverageData, combine_parallel_data
 from coverage.debug import DebugControl, short_stack, write_formatted_info
 from coverage.disposition import disposition_debug_msg
-from coverage.exceptions import CoverageException, CoverageWarning
+from coverage.exceptions import ConfigError, CoverageException, CoverageWarning, PluginError
 from coverage.files import PathAliases, abs_file, relative_filename, set_relative_directory
 from coverage.html import HtmlReporter
 from coverage.inorout import InOrOut
@@ -79,6 +79,8 @@
     not part of the public API. They might stop working at any point.  Please
     limit yourself to documented methods to avoid problems.
 
+    Methods can raise any of the exceptions described in :ref:`api_exceptions`.
+
     """
 
     # The stack of started Coverage instances.
@@ -446,10 +448,10 @@
     def _init_for_start(self):
         """Initialization for start()"""
         # Construct the collector.
-        concurrency = self.config.concurrency or ()
+        concurrency = self.config.concurrency or []
         if "multiprocessing" in concurrency:
             if not patch_multiprocessing:
-                raise CoverageException(                    # pragma: only jython
+                raise ConfigError(                      # pragma: only jython
                     "multiprocessing is not supported on this Python"
                 )
             patch_multiprocessing(rcfile=self.config.config_file)
@@ -460,7 +462,7 @@
         elif dycon == "test_function":
             context_switchers = [should_start_context_test_function]
         else:
-            raise CoverageException(f"Don't understand dynamic_context setting: {dycon!r}")
+            raise ConfigError(f"Don't understand dynamic_context setting: {dycon!r}")
 
         context_switchers.extend(
             plugin.dynamic_context for plugin in self._plugins.context_switchers
@@ -480,10 +482,15 @@
             )
 
         suffix = self._data_suffix_specified
-        if suffix or self.config.parallel:
+        if suffix:
             if not isinstance(suffix, str):
                 # if data_suffix=True, use .machinename.pid.random
                 suffix = True
+        elif self.config.parallel:
+            if suffix is None:
+                suffix = True
+            elif not isinstance(suffix, str):
+                suffix = bool(suffix)
         else:
             suffix = None
 
@@ -835,7 +842,7 @@
                 if plugin:
                     file_reporter = plugin.file_reporter(mapped_morf)
                     if file_reporter is None:
-                        raise CoverageException(
+                        raise PluginError(
                             "Plugin {!r} did not provide a file reporter for {!r}.".format(
                                 plugin._coverage_plugin_name, morf
                             )
@@ -933,9 +940,10 @@
         """Annotate a list of modules.
 
         .. note::
-           This method has been obsoleted by more modern reporting tools,
-           including the :meth:`html_report` method.  It will be removed in a
-           future version.
+
+            This method has been obsoleted by more modern reporting tools,
+            including the :meth:`html_report` method.  It will be removed in a
+            future version.
 
         Each module in `morfs` is annotated.  The source is written to a new
         file, named with a ",cover" suffix, with each line prefixed with a
@@ -978,6 +986,7 @@
         Returns a float, the total percentage covered.
 
         .. note::
+
             The HTML report files are generated incrementally based on the
             source files and coverage results. If you modify the report files,
             the changes will not be considered.  You should be careful about

eric ide

mercurial