Skip to content

Commit 4cc3eb4

Browse files
isaiahberkerpeksag
authored andcommitted
bpo-32384: Skip test when _testcapi isn't available (GH-4940)
1 parent 3055c94 commit 4cc3eb4

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
@@ -9,12 +9,18 @@
99

1010
from test import support
1111

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

1417

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

2026
def generator1(self):

0 commit comments

Comments
 (0)