diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-06-23 13:24:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-23 13:24:28 (GMT) |
commit | cea2174ab7cce01c420b2770562be4c91f1f4e35 (patch) | |
tree | ca9fa551a91a2f87ce61f0e28b39ac66e7ef87f9 | |
parent | d32a05953130fb5cc2d3c0c9fcb20ad0859353f3 (diff) | |
download | cpython-cea2174ab7cce01c420b2770562be4c91f1f4e35.zip cpython-cea2174ab7cce01c420b2770562be4c91f1f4e35.tar.gz cpython-cea2174ab7cce01c420b2770562be4c91f1f4e35.tar.bz2 |
bpo-30604: Skip CoExtra tests if ctypes is missing (#2356) (#2358)
(cherry picked from commit a4b091e135ccf345cfafdd8477aef897c5214f82)
-rw-r--r-- | Lib/test/test_code.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index 9f9df9d..6853748 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -106,6 +106,10 @@ import sys import threading import unittest import weakref +try: + import ctypes +except ImportError: + ctypes = None from test.support import (run_doctest, run_unittest, cpython_only, check_impl_detail) @@ -214,8 +218,7 @@ class CodeWeakRefTest(unittest.TestCase): self.assertTrue(self.called) -if check_impl_detail(cpython=True): - import ctypes +if check_impl_detail(cpython=True) and ctypes is not None: py = ctypes.pythonapi freefunc = ctypes.CFUNCTYPE(None,ctypes.c_voidp) @@ -311,7 +314,7 @@ def test_main(verbose=None): from test import test_code run_doctest(test_code, verbose) tests = [CodeTest, CodeConstsTest, CodeWeakRefTest] - if check_impl_detail(cpython=True): + if check_impl_detail(cpython=True) and ctypes is not None: tests.append(CoExtra) run_unittest(*tests) |