diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-05-16 09:17:25 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-05-16 09:17:25 (GMT) |
commit | 5e8c52680450b67a116d3d555db8416c40576fdb (patch) | |
tree | 64174906607dfe80dbac9fe047cdf009777371f6 | |
parent | 8fa36b6be47356f8e42a8bd0b3dba24a8fbd6c35 (diff) | |
download | cpython-5e8c52680450b67a116d3d555db8416c40576fdb.zip cpython-5e8c52680450b67a116d3d555db8416c40576fdb.tar.gz cpython-5e8c52680450b67a116d3d555db8416c40576fdb.tar.bz2 |
bpo-32384: Skip test when _testcapi isn't available (GH-4940)
(cherry picked from commit 4cc3eb48e1e8289df5153db1c701cae263a1ef86)
Co-authored-by: Isaiah Peng <isaiah@users.noreply.github.com>
-rw-r--r-- | Lib/test/test_generators.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index d9ceeb5..67c2a6d 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -10,12 +10,18 @@ import types 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). +@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): |