[Python-checkins] bpo-32384: Skip test when _testcapi isn't available (GH-4940)

Berker Peksag webhook-mailer at python.org
Wed May 16 04:35:09 EDT 2018


https://github.com/python/cpython/commit/4af6110f77e141779492995fd168d4f027fcf3cf
commit: 4af6110f77e141779492995fd168d4f027fcf3cf
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Berker Peksag <berker.peksag at gmail.com>
date: 2018-05-16T11:35:06+03:00
summary:

bpo-32384: Skip test when _testcapi isn't available (GH-4940)

(cherry picked from commit 4cc3eb48e1e8289df5153db1c701cae263a1ef86)

Co-authored-by: Isaiah Peng <isaiah at users.noreply.github.com>

files:
M Lib/test/test_generators.py

diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 7360b34023d3..7a21cb7e954a 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -9,12 +9,18 @@
 
 from test import support
 
-_testcapi = support.import_module('_testcapi')
+try:
+    import _testcapi
+except ImportError:
+    _testcapi = None
 
 
 # This tests to make sure that if a SIGINT arrives just before we send into a
 # yield from chain, the KeyboardInterrupt is raised in the innermost
 # generator (see bpo-30039).
+ at unittest.skipUnless(_testcapi is not None and
+                     hasattr(_testcapi, "raise_SIGINT_then_send_None"),
+                     "needs _testcapi.raise_SIGINT_then_send_None")
 class SignalAndYieldFromTest(unittest.TestCase):
 
     def generator1(self):



More information about the Python-checkins mailing list