]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-115142: Skip some test cases in ``Lib/test/test_compile`` if ``_testinternalcapi...
authorKirill Podoprigora <kirill.bast9@mail.ru>
Mon, 30 Sep 2024 19:13:23 +0000 (22:13 +0300)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2024 19:13:23 +0000 (22:13 +0300)
* Skip some test cases if "_testinternalcapi" is not available and if the test suite is
   running on another implementation than CPython.

Lib/test/test_compile.py

index f7ef7a1c26f7bd16d17012ef1dbfde1c5e2e9c0e..e9ee72cf234fdc0e0427835c22df88b89e813371 100644 (file)
@@ -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()],