From 8b65ba2e0419087b5b24ea04107e983323940ee0 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 13 Jan 2017 07:11:04 -0500 Subject: Jython has no multiprocessing module --- tests/test_concurrency.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests/test_concurrency.py') diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index e36db30d..b441909f 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -3,7 +3,6 @@ """Tests for concurrency libraries.""" -import multiprocessing import threading import coverage @@ -15,6 +14,11 @@ from tests.coveragetest import CoverageTest # These libraries aren't always available, we'll skip tests if they aren't. +try: + import multiprocessing +except ImportError: # pragma: only jython + multiprocessing = None + try: import eventlet except ImportError: @@ -25,7 +29,10 @@ try: except ImportError: gevent = None -import greenlet +try: + import greenlet +except ImportError: # pragma: only jython + greenlet = None def measurable_line(l): @@ -345,6 +352,11 @@ MULTI_CODE = """ class MultiprocessingTest(CoverageTest): """Test support of the multiprocessing module.""" + def setUp(self): + if not multiprocessing: + self.skip("No multiprocessing in this Python") # pragma: only jython + super(MultiprocessingTest, self).setUp() + def try_multiprocessing_code( self, code, expected_out, the_module, concurrency="multiprocessing" ): -- cgit v1.2.1