File tree Expand file tree Collapse file tree 6 files changed +16
-21
lines changed Expand file tree Collapse file tree 6 files changed +16
-21
lines changed Original file line number Diff line number Diff line change 2020
2121from queue import Empty , Full
2222
23- import _multiprocessing
24-
2523from . import connection
2624from . import context
2725_ForkingPickler = context .reduction .ForkingPickler
Original file line number Diff line number Diff line change 55import sys
66import types
77
8- try :
9- import _multiprocessing
10- except ModuleNotFoundError :
11- _multiprocessing = None
12-
138
149if support .check_sanitizer (address = True , memory = True ):
1510 SKIP_MODULES = frozenset ((
@@ -36,17 +31,6 @@ class FailedImport(RuntimeError):
3631
3732class AllTest (unittest .TestCase ):
3833
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-
5034 def check_all (self , modname ):
5135 names = {}
5236 with warnings_helper .check_warnings (
Original file line number Diff line number Diff line change 33from test import support
44from test .support import import_helper
55
6- # Skip tests if _multiprocessing wasn't built.
7- import_helper .import_module ('_multiprocessing' )
86
97if support .check_sanitizer (address = True , memory = True ):
108 # gh-90791: Skip the test because it is too slow when Python is built
Original file line number Diff line number Diff line change 55import unittest
66import sys
77from concurrent .futures ._base import BrokenExecutor
8+ from concurrent .futures .process import _check_system_limits
9+
810from logging .handlers import QueueHandler
911
1012from test import support
@@ -117,6 +119,11 @@ class FailingInitializerResourcesTest(unittest.TestCase):
117119 """
118120
119121 def _test (self , test_class ):
122+ try :
123+ _check_system_limits ()
124+ except NotImplementedError :
125+ self .skipTest ("ProcessPoolExecutor unavailable on this system" )
126+
120127 runner = unittest .TextTestRunner ()
121128 runner .run (test_class ('test_initializer' ))
122129
Original file line number Diff line number Diff line change @@ -136,6 +136,12 @@ def strip_mixin(name):
136136
137137
138138def 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+
140146 thread_info = threading_helper .threading_setup ()
141147 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