diff options
author | Isaiah Peng <isaiah@users.noreply.github.com> | 2018-05-16 08:05:17 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2018-05-16 08:05:17 (GMT) |
commit | 4cc3eb48e1e8289df5153db1c701cae263a1ef86 (patch) | |
tree | 43d7ce36baa8b6a641839f1944ade80a451cb7de /Lib | |
parent | 3055c947f98a078bd10d6a8cc352048a1b771d60 (diff) | |
download | cpython-4cc3eb48e1e8289df5153db1c701cae263a1ef86.zip cpython-4cc3eb48e1e8289df5153db1c701cae263a1ef86.tar.gz cpython-4cc3eb48e1e8289df5153db1c701cae263a1ef86.tar.bz2 |
bpo-32384: Skip test when _testcapi isn't available (GH-4940)
Diffstat (limited to 'Lib')
-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 7360b34..7a21cb7 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -9,12 +9,18 @@ import inspect 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): |