|
24 | 24 | from fileinput import FileInput |
25 | 25 | from itertools import chain |
26 | 26 | from http.cookies import Morsel |
27 | | -from multiprocessing.managers import ValueProxy |
28 | | -from multiprocessing.pool import ApplyResult |
| 27 | +try: |
| 28 | + from multiprocessing.managers import ValueProxy |
| 29 | + from multiprocessing.pool import ApplyResult |
| 30 | + from multiprocessing.queues import SimpleQueue as MPSimpleQueue |
| 31 | +except ImportError: |
| 32 | + # _multiprocessing module is optional |
| 33 | + ValueProxy = None |
| 34 | + ApplyResult = None |
| 35 | + MPSimpleQueue = None |
29 | 36 | try: |
30 | 37 | from multiprocessing.shared_memory import ShareableList |
31 | 38 | except ImportError: |
32 | 39 | # multiprocessing.shared_memory is not available on e.g. Android |
33 | 40 | ShareableList = None |
34 | | -from multiprocessing.queues import SimpleQueue as MPSimpleQueue |
35 | 41 | from os import DirEntry |
36 | 42 | from re import Pattern, Match |
37 | 43 | from types import GenericAlias, MappingProxyType, AsyncGeneratorType |
@@ -79,13 +85,14 @@ class BaseTest(unittest.TestCase): |
79 | 85 | Queue, SimpleQueue, |
80 | 86 | _AssertRaisesContext, |
81 | 87 | SplitResult, ParseResult, |
82 | | - ValueProxy, ApplyResult, |
83 | 88 | WeakSet, ReferenceType, ref, |
84 | | - ShareableList, MPSimpleQueue, |
| 89 | + ShareableList, |
85 | 90 | Future, _WorkItem, |
86 | 91 | Morsel] |
87 | 92 | if ctypes is not None: |
88 | 93 | generic_types.extend((ctypes.Array, ctypes.LibraryLoader)) |
| 94 | + if ValueProxy is not None: |
| 95 | + generic_types.extend((ValueProxy, ApplyResult, MPSimpleQueue)) |
89 | 96 |
|
90 | 97 | def test_subscriptable(self): |
91 | 98 | for t in self.generic_types: |
|
0 commit comments