summaryrefslogtreecommitdiffstats
path: root/Lib/test/test___all__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test___all__.py')
-rw-r--r--Lib/test/test___all__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 15f42d2..81293e1 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -3,6 +3,12 @@ from test import support
from test.support import warnings_helper
import os
import sys
+import types
+
+try:
+ import _multiprocessing
+except ModuleNotFoundError:
+ _multiprocessing = None
class NoAll(RuntimeError):
@@ -14,6 +20,17 @@ class FailedImport(RuntimeError):
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(