Skip to content

Commit 1c0bd8b

Browse files
authored
pythongh-115142: Skip some test cases in Lib/test/test_compile if _testinternalcapi is not available (python#124474)
* Skip some test cases if "_testinternalcapi" is not available and if the test suite is running on another implementation than CPython.
1 parent e44eebf commit 1c0bd8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/test/test_compile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
import types
1414
import textwrap
1515
import warnings
16-
import _testinternalcapi
16+
try:
17+
import _testinternalcapi
18+
except ImportError:
19+
_testinternalcapi = None
1720

1821
from test import support
1922
from test.support import (script_helper, requires_debug_ranges, run_code,
@@ -2645,6 +2648,8 @@ def test_return_inside_async_with_block(self):
26452648
"""
26462649
self.check_stack_size(snippet, async_=True)
26472650

2651+
@support.cpython_only
2652+
@unittest.skipIf(_testinternalcapi is None, 'need _testinternalcapi module')
26482653
class TestInstructionSequence(unittest.TestCase):
26492654
def compare_instructions(self, seq, expected):
26502655
self.assertEqual([(opcode.opname[i[0]],) + i[1:] for i in seq.get_instructions()],

0 commit comments

Comments
 (0)