File tree 6 files changed +16
-21
lines changed 6 files changed +16
-21
lines changed Original file line number Diff line number Diff line change 20
20
21
21
from queue import Empty , Full
22
22
23
- import _multiprocessing
24
-
25
23
from . import connection
26
24
from . import context
27
25
_ForkingPickler = context .reduction .ForkingPickler
Original file line number Diff line number Diff line change 5
5
import sys
6
6
import types
7
7
8
- try :
9
- import _multiprocessing
10
- except ModuleNotFoundError :
11
- _multiprocessing = None
12
-
13
8
14
9
if support .check_sanitizer (address = True , memory = True ):
15
10
SKIP_MODULES = frozenset ((
@@ -36,17 +31,6 @@ class FailedImport(RuntimeError):
36
31
37
32
class AllTest (unittest .TestCase ):
38
33
39
- def setUp (self ):
40
- # concurrent.futures uses a __getattr__ hook. Its __all__ triggers
41
- # import of a submodule, which fails when _multiprocessing is not
42
- # available.
43
- if _multiprocessing is None :
44
- sys .modules ["_multiprocessing" ] = types .ModuleType ("_multiprocessing" )
45
-
46
- def tearDown (self ):
47
- if _multiprocessing is None :
48
- sys .modules .pop ("_multiprocessing" )
49
-
50
34
def check_all (self , modname ):
51
35
names = {}
52
36
with warnings_helper .check_warnings (
Original file line number Diff line number Diff line change 3
3
from test import support
4
4
from test .support import import_helper
5
5
6
- # Skip tests if _multiprocessing wasn't built.
7
- import_helper .import_module ('_multiprocessing' )
8
6
9
7
if support .check_sanitizer (address = True , memory = True ):
10
8
# gh-90791: Skip the test because it is too slow when Python is built
Original file line number Diff line number Diff line change 5
5
import unittest
6
6
import sys
7
7
from concurrent .futures ._base import BrokenExecutor
8
+ from concurrent .futures .process import _check_system_limits
9
+
8
10
from logging .handlers import QueueHandler
9
11
10
12
from test import support
@@ -117,6 +119,11 @@ class FailingInitializerResourcesTest(unittest.TestCase):
117
119
"""
118
120
119
121
def _test (self , test_class ):
122
+ try :
123
+ _check_system_limits ()
124
+ except NotImplementedError :
125
+ self .skipTest ("ProcessPoolExecutor unavailable on this system" )
126
+
120
127
runner = unittest .TextTestRunner ()
121
128
runner .run (test_class ('test_initializer' ))
122
129
Original file line number Diff line number Diff line change @@ -136,6 +136,12 @@ def strip_mixin(name):
136
136
137
137
138
138
def setup_module ():
139
- unittest .addModuleCleanup (multiprocessing .util ._cleanup_tests )
139
+ try :
140
+ _check_system_limits ()
141
+ except NotImplementedError :
142
+ pass
143
+ else :
144
+ unittest .addModuleCleanup (multiprocessing .util ._cleanup_tests )
145
+
140
146
thread_info = threading_helper .threading_setup ()
141
147
unittest .addModuleCleanup (threading_helper .threading_cleanup , * thread_info )
Original file line number Diff line number Diff line change
1
+ Enable ``test_concurrent_futures `` on platforms that support threading but not
2
+ multiprocessing.
You can’t perform that action at this time.
0 commit comments