Skip to content

Commit

Permalink
pythongh-115142: Skip some test cases in Lib/test/test_compile if…
Browse files Browse the repository at this point in the history
… ``_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.
  • Loading branch information
Eclips4 authored Sep 30, 2024
1 parent e44eebf commit 1c0bd8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Lib/test/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
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,
Expand Down Expand Up @@ -2645,6 +2648,8 @@ def test_return_inside_async_with_block(self):
"""
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()],
Expand Down

0 comments on commit 1c0bd8b

Please sign in to comment.