From 6f155b6e289b00cee4bb08146e326a270bf87235 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Wed, 25 Sep 2024 00:08:58 +0300 Subject: [PATCH 1/2] Skip some test cases if ``_testinternalcapi`` is not availble --- Lib/test/test_compile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 736eff35c1d5f2..a6ae64513e69bf 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -12,7 +12,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, @@ -2605,6 +2608,7 @@ def test_return_inside_async_with_block(self): """ self.check_stack_size(snippet, async_=True) +@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()], From c1a6efb1f00b100ca5e4dc5f3e56d8c4be7e4806 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Wed, 25 Sep 2024 01:25:08 +0300 Subject: [PATCH 2/2] Skip TestInstructionSequence for other implementations --- Lib/test/test_compile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index a6ae64513e69bf..0e670f1d7e044a 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -2608,6 +2608,7 @@ 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):