Enable test_concurrent_futures on platforms that support threading but not multiprocessing.
from queue import Empty, Full
-import _multiprocessing
-
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
import sys
import types
-try:
- import _multiprocessing
-except ModuleNotFoundError:
- _multiprocessing = None
-
if support.check_sanitizer(address=True, memory=True):
SKIP_MODULES = frozenset((
class AllTest(unittest.TestCase):
- def setUp(self):
- # concurrent.futures uses a __getattr__ hook. Its __all__ triggers
- # import of a submodule, which fails when _multiprocessing is not
- # available.
- if _multiprocessing is None:
- sys.modules["_multiprocessing"] = types.ModuleType("_multiprocessing")
-
- def tearDown(self):
- if _multiprocessing is None:
- sys.modules.pop("_multiprocessing")
-
def check_all(self, modname):
names = {}
with warnings_helper.check_warnings(
from test import support
from test.support import import_helper
-# Skip tests if _multiprocessing wasn't built.
-import_helper.import_module('_multiprocessing')
if support.check_sanitizer(address=True, memory=True):
# gh-90791: Skip the test because it is too slow when Python is built
import unittest
import sys
from concurrent.futures._base import BrokenExecutor
+from concurrent.futures.process import _check_system_limits
+
from logging.handlers import QueueHandler
from test import support
"""
def _test(self, test_class):
+ try:
+ _check_system_limits()
+ except NotImplementedError:
+ self.skipTest("ProcessPoolExecutor unavailable on this system")
+
runner = unittest.TextTestRunner()
runner.run(test_class('test_initializer'))
def setup_module():
- unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)
+ try:
+ _check_system_limits()
+ except NotImplementedError:
+ pass
+ else:
+ unittest.addModuleCleanup(multiprocessing.util._cleanup_tests)
+
thread_info = threading_helper.threading_setup()
unittest.addModuleCleanup(threading_helper.threading_cleanup, *thread_info)
--- /dev/null
+Enable ``test_concurrent_futures`` on platforms that support threading but not
+multiprocessing.