diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-13 07:11:04 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-13 07:11:04 -0500 |
commit | d2e93d4f93373065230ae5f2d1b58338e5ba6819 (patch) | |
tree | 8b5173a76f2fe103f200b24d4377253bddaad41e /coverage/control.py | |
parent | d82cef5f0bc3b56bb3dd4d473f098fa562b575e5 (diff) | |
download | python-coveragepy-d2e93d4f93373065230ae5f2d1b58338e5ba6819.tar.gz |
Jython has no multiprocessing module
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/coverage/control.py b/coverage/control.py index 992ca58..037fc6d 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -24,7 +24,6 @@ from coverage.files import ModuleMatcher, abs_file from coverage.html import HtmlReporter from coverage.misc import CoverageException, bool_or_none, join_regex from coverage.misc import file_be_gone, isolate_module -from coverage.multiproc import patch_multiprocessing from coverage.plugin import FileReporter from coverage.plugin_support import Plugins from coverage.python import PythonFileReporter @@ -32,6 +31,12 @@ from coverage.results import Analysis, Numbers from coverage.summary import SummaryReporter from coverage.xmlreport import XmlReporter +try: + from coverage.multiproc import patch_multiprocessing +except ImportError: # pragma: only jython + # Jython has no multiprocessing module. + patch_multiprocessing = None + os = isolate_module(os) # Pypy has some unusual stuff in the "stdlib". Consider those locations @@ -229,6 +234,10 @@ class Coverage(object): concurrency = self.config.concurrency or [] if "multiprocessing" in concurrency: + if not patch_multiprocessing: + raise CoverageException( # pragma: only jython + "multiprocessing is not supported on this Python" + ) patch_multiprocessing(rcfile=self.config_file) # Multi-processing uses parallel for the subprocesses, so also use # it for the main process. |