gh-101758: Fix the wasm Buildbots (gh-101943)

They were broken by gh-101920.

https://github.com/python/cpython/issues/101758
This commit is contained in:
Eric Snow 2023-02-15 17:54:05 -07:00 committed by GitHub
parent b365d88465
commit 3dea4ba6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -16,12 +16,21 @@ import warnings
imp = warnings_helper.import_deprecated('imp')
import _imp
import _testinternalcapi
import _xxsubinterpreters as _interpreters
try:
import _xxsubinterpreters as _interpreters
except ModuleNotFoundError:
_interpreters = None
OS_PATH_NAME = os.path.__name__
def requires_subinterpreters(meth):
"""Decorator to skip a test if subinterpreters are not supported."""
return unittest.skipIf(_interpreters is None,
'subinterpreters required')(meth)
def requires_load_dynamic(meth):
"""Decorator to skip a test if not running under CPython or lacking
imp.load_dynamic()."""
@ -254,6 +263,7 @@ class ImportTests(unittest.TestCase):
with self.assertRaises(ImportError):
imp.load_dynamic('nonexistent', pathname)
@requires_subinterpreters
@requires_load_dynamic
def test_singlephase_multiple_interpreters(self):
# Currently, for every single-phrase init module loaded