Skip to content

Commit 5e8c526

Browse files
miss-islingtonisaiah
authored andcommitted
bpo-32384: Skip test when _testcapi isn't available (GH-4940)
(cherry picked from commit 4cc3eb4) Co-authored-by: Isaiah Peng <[email protected]>
1 parent 8fa36b6 commit 5e8c526

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_generators.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010

1111
from test import support
1212

13-
_testcapi = support.import_module('_testcapi')
13+
try:
14+
import _testcapi
15+
except ImportError:
16+
_testcapi = None
1417

1518

1619
# This tests to make sure that if a SIGINT arrives just before we send into a
1720
# yield from chain, the KeyboardInterrupt is raised in the innermost
1821
# generator (see bpo-30039).
22+
@unittest.skipUnless(_testcapi is not None and
23+
hasattr(_testcapi, "raise_SIGINT_then_send_None"),
24+
"needs _testcapi.raise_SIGINT_then_send_None")
1925
class SignalAndYieldFromTest(unittest.TestCase):
2026

2127
def generator1(self):

0 commit comments

Comments
 (0)