10000 gh-106931: Fix the WASM Buildbots (gh-107362) · python/cpython@2f9bb77 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f9bb77

Browse files
gh-106931: Fix the WASM Buildbots (gh-107362)
Skip subinterpreter tests when not supported.
1 parent 8bdae14 commit 2f9bb77

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Lib/test/test_sys.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@
1414
from test.support.script_helper import assert_python_ok, assert_python_failure
1515
from test.support import threading_helper
1616
from test.support import import_helper
17-
from test.support import interpreters
17+
try:
18+
from test.support import interpreters
19+
except ImportError:
20+
interpreters = None
1821
import textwrap
1922
import unittest
2023
import warnings
2124

2225

26+
def requires_subinterpreters(meth):
27+
"""Decorator to skip a test if subinterpreters are not supported."""
28+
return unittest.skipIf(interpreters is None,
29+
'subinterpreters required')(meth)
30+
31+
2332
# count the number of test runs, used to create unique
2433
# strings to intern in test_intern()
2534
INTERN_NUMRUNS = 0
@@ -700,6 +709,7 @@ def __hash__(self):
700709

701710
self.assertRaises(TypeError, sys.intern, S("abc"))
702711

712+
@requires_subinterpreters
703713
def test_subinterp_intern_dynamically_allocated(self):
704714
global INTERN_NUMRUNS
705715
INTERN_NUMRUNS += 1
@@ -715,6 +725,7 @@ def test_subinterp_intern_dynamically_allocated(self):
715725
assert id(t) != {id(t)}, (id(t), {id(t)})
716726
'''))
717727

728+
@requires_subinterpreters
718729
def test_subinterp_intern_statically_allocated(self):
719730
# See Tools/build/generate_global_objects.py for the list
720731
# of strings that are always statically allocated.

0 commit comments

Comments
 (0)
0