mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
(cherry picked from commit a4b091e135
)
This commit is contained in:
parent
d32a059531
commit
cea2174ab7
1 changed files with 6 additions and 3 deletions
|
@ -106,6 +106,10 @@ import sys
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
import weakref
|
import weakref
|
||||||
|
try:
|
||||||
|
import ctypes
|
||||||
|
except ImportError:
|
||||||
|
ctypes = None
|
||||||
from test.support import (run_doctest, run_unittest, cpython_only,
|
from test.support import (run_doctest, run_unittest, cpython_only,
|
||||||
check_impl_detail)
|
check_impl_detail)
|
||||||
|
|
||||||
|
@ -214,8 +218,7 @@ class CodeWeakRefTest(unittest.TestCase):
|
||||||
self.assertTrue(self.called)
|
self.assertTrue(self.called)
|
||||||
|
|
||||||
|
|
||||||
if check_impl_detail(cpython=True):
|
if check_impl_detail(cpython=True) and ctypes is not None:
|
||||||
import ctypes
|
|
||||||
py = ctypes.pythonapi
|
py = ctypes.pythonapi
|
||||||
freefunc = ctypes.CFUNCTYPE(None,ctypes.c_voidp)
|
freefunc = ctypes.CFUNCTYPE(None,ctypes.c_voidp)
|
||||||
|
|
||||||
|
@ -311,7 +314,7 @@ def test_main(verbose=None):
|
||||||
from test import test_code
|
from test import test_code
|
||||||
run_doctest(test_code, verbose)
|
run_doctest(test_code, verbose)
|
||||||
tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
|
tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
|
||||||
if check_impl_detail(cpython=True):
|
if check_impl_detail(cpython=True) and ctypes is not None:
|
||||||
tests.append(CoExtra)
|
tests.append(CoExtra)
|
||||||
run_unittest(*tests)
|
run_unittest(*tests)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue