summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Podoprigora <kirill.bast9@mail.ru>2024-09-30 19:13:23 (GMT)
committerGitHub <noreply@github.com>2024-09-30 19:13:23 (GMT)
commit1c0bd8bd00287d3bd6830aca87bb14e047192008 (patch)
treebadb5924528a5c4a4a96cf838b43b62f96bd5d94
parente44eebfc1eccdaaebc219accbfc705c9a9de068d (diff)
downloadcpython-1c0bd8bd00287d3bd6830aca87bb14e047192008.zip
cpython-1c0bd8bd00287d3bd6830aca87bb14e047192008.tar.gz
cpython-1c0bd8bd00287d3bd6830aca87bb14e047192008.tar.bz2
gh-115142: Skip some test cases in ``Lib/test/test_compile`` if ``_testinternalcapi`` is not available (#124474)
* Skip some test cases if "_testinternalcapi" is not available and if the test suite is running on another implementation than CPython.
-rw-r--r--Lib/test/test_compile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index f7ef7a1..e9ee72c 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -13,7 +13,10 @@ import tempfile
import types
import textwrap
import warnings
-import _testinternalcapi
+try:
+ import _testinternalcapi
+except ImportError:
+ _testinternalcapi = None
from test import support
from test.support import (script_helper, requires_debug_ranges, run_code,
@@ -2645,6 +2648,8 @@ class TestStackSizeStability(unittest.TestCase):
"""
self.check_stack_size(snippet, async_=True)
+@support.cpython_only
+@unittest.skipIf(_testinternalcapi is None, 'need _testinternalcapi module')
class TestInstructionSequence(unittest.TestCase):
def compare_instructions(self, seq, expected):
self.assertEqual([(opcode.opname[i[0]],) + i[1:] for i in seq.get_instructions()],