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

(cherry picked from commit 4cc3eb48e1)

Co-authored-by: Isaiah Peng <isaiah@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2018-05-16 01:35:06 -07:00 committed by Berker Peksag
parent c73268aad7
commit 4af6110f77
1 changed files with 7 additions and 1 deletions

View File

@ -9,12 +9,18 @@ import inspect
from test import support 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 # 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 # yield from chain, the KeyboardInterrupt is raised in the innermost
# generator (see bpo-30039). # 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): class SignalAndYieldFromTest(unittest.TestCase):
def generator1(self): def generator1(self):