diff options
author | Christian Heimes <christian@python.org> | 2022-01-20 17:56:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 17:56:33 (GMT) |
commit | c02e860ee79f29905be6fca997c96bb1a404bb32 (patch) | |
tree | a4376cbc44b23a6eb5919fee929ae0a63cec1c36 /Lib/test/test___all__.py | |
parent | ef3ef6fa43d5cca072eed2a66064e818de583be7 (diff) | |
download | cpython-c02e860ee79f29905be6fca997c96bb1a404bb32.zip cpython-c02e860ee79f29905be6fca997c96bb1a404bb32.tar.gz cpython-c02e860ee79f29905be6fca997c96bb1a404bb32.tar.bz2 |
bpo-40280: Misc fixes for wasm32-emscripten (GH-30722)
Diffstat (limited to 'Lib/test/test___all__.py')
-rw-r--r-- | Lib/test/test___all__.py | 17 |
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( |