import multiprocessing.heap
import multiprocessing.pool
-from multiprocessing import util, reduction
+from multiprocessing import util
+
+try:
+ from multiprocessing import reduction
+ HAS_REDUCTION = True
+except ImportError:
+ HAS_REDUCTION = False
try:
from multiprocessing.sharedctypes import Value, copy
os.write(fd, data)
os.close(fd)
+ @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
def test_fd_transfer(self):
if self.TYPE != 'processes':
self.skipTest("only makes sense with processes")
with open(test.support.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"foo")
+ @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
@unittest.skipIf(sys.platform == "win32",
"test semantics don't make sense on Windows")
@unittest.skipIf(MAXFD <= 256,
def _send_data_without_fd(self, conn):
os.write(conn.fileno(), b"\0")
+ @unittest.skipUnless(HAS_REDUCTION, "test needs multiprocessing.reduction")
@unittest.skipIf(sys.platform == "win32", "doesn't make sense on Windows")
def test_missing_fd_transfer(self):
# Check that exception is raised when received data is not
'multiprocessing', 'multiprocessing.connection',
'multiprocessing.heap', 'multiprocessing.managers',
'multiprocessing.pool', 'multiprocessing.process',
- 'multiprocessing.reduction',
'multiprocessing.synchronize', 'multiprocessing.util'
]
+ if HAS_REDUCTION:
+ modules.append('multiprocessing.reduction')
+
if c_int is not None:
# This module requires _ctypes
modules.append('multiprocessing.sharedctypes')