bpo-41477: Make ctypes optional in test_genericalias (GH-21766)
This commit is contained in:
parent
598a951844
commit
f44693eaed
|
@ -13,7 +13,10 @@ from contextvars import ContextVar, Token
|
||||||
from dataclasses import Field
|
from dataclasses import Field
|
||||||
from functools import partial, partialmethod, cached_property
|
from functools import partial, partialmethod, cached_property
|
||||||
from mailbox import Mailbox, _PartialFile
|
from mailbox import Mailbox, _PartialFile
|
||||||
from ctypes import Array, LibraryLoader
|
try:
|
||||||
|
import ctypes
|
||||||
|
except ImportError:
|
||||||
|
ctypes = None
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
from filecmp import dircmp
|
from filecmp import dircmp
|
||||||
from fileinput import FileInput
|
from fileinput import FileInput
|
||||||
|
@ -46,7 +49,7 @@ class BaseTest(unittest.TestCase):
|
||||||
"""Test basics."""
|
"""Test basics."""
|
||||||
|
|
||||||
def test_subscriptable(self):
|
def test_subscriptable(self):
|
||||||
for t in (type, tuple, list, dict, set, frozenset, enumerate,
|
types = [type, tuple, list, dict, set, frozenset, enumerate,
|
||||||
defaultdict, deque,
|
defaultdict, deque,
|
||||||
SequenceMatcher,
|
SequenceMatcher,
|
||||||
dircmp,
|
dircmp,
|
||||||
|
@ -75,14 +78,15 @@ class BaseTest(unittest.TestCase):
|
||||||
TemporaryDirectory, SpooledTemporaryFile,
|
TemporaryDirectory, SpooledTemporaryFile,
|
||||||
Queue, SimpleQueue,
|
Queue, SimpleQueue,
|
||||||
_AssertRaisesContext,
|
_AssertRaisesContext,
|
||||||
Array, LibraryLoader,
|
|
||||||
SplitResult, ParseResult,
|
SplitResult, ParseResult,
|
||||||
ValueProxy, ApplyResult,
|
ValueProxy, ApplyResult,
|
||||||
WeakSet, ReferenceType, ref,
|
WeakSet, ReferenceType, ref,
|
||||||
ShareableList, SimpleQueue,
|
ShareableList, SimpleQueue,
|
||||||
Future, _WorkItem,
|
Future, _WorkItem,
|
||||||
Morsel,
|
Morsel]
|
||||||
):
|
if ctypes is not None:
|
||||||
|
types.extend((ctypes.Array, ctypes.LibraryLoader))
|
||||||
|
for t in types:
|
||||||
if t is None:
|
if t is None:
|
||||||
continue
|
continue
|
||||||
tname = t.__name__
|
tname = t.__name__
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Make ctypes optional in test_genericalias.
|
Loading…
Reference in New Issue