diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-07-27 21:46:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 21:46:02 (GMT) |
commit | 2f9bb77764c3b41867f79d6df6e2ed71715dad63 (patch) | |
tree | 15e086e06d50651ec473cb75db0e7f356c5ce185 /Lib | |
parent | 8bdae1424b54e5106782f2b9e2fadce444dc84cd (diff) | |
download | cpython-2f9bb77764c3b41867f79d6df6e2ed71715dad63.zip cpython-2f9bb77764c3b41867f79d6df6e2ed71715dad63.tar.gz cpython-2f9bb77764c3b41867f79d6df6e2ed71715dad63.tar.bz2 |
gh-106931: Fix the WASM Buildbots (gh-107362)
Skip subinterpreter tests when not supported.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sys.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 78ed4bb..9dce15e 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -14,12 +14,21 @@ from test.support import os_helper from test.support.script_helper import assert_python_ok, assert_python_failure from test.support import threading_helper from test.support import import_helper -from test.support import interpreters +try: + from test.support import interpreters +except ImportError: + interpreters = None import textwrap import unittest import warnings +def requires_subinterpreters(meth): + """Decorator to skip a test if subinterpreters are not supported.""" + return unittest.skipIf(interpreters is None, + 'subinterpreters required')(meth) + + # count the number of test runs, used to create unique # strings to intern in test_intern() INTERN_NUMRUNS = 0 @@ -700,6 +709,7 @@ class SysModuleTest(unittest.TestCase): self.assertRaises(TypeError, sys.intern, S("abc")) + @requires_subinterpreters def test_subinterp_intern_dynamically_allocated(self): global INTERN_NUMRUNS INTERN_NUMRUNS += 1 @@ -715,6 +725,7 @@ class SysModuleTest(unittest.TestCase): assert id(t) != {id(t)}, (id(t), {id(t)}) ''')) + @requires_subinterpreters def test_subinterp_intern_statically_allocated(self): # See Tools/build/generate_global_objects.py for the list # of strings that are always statically allocated. |