Skip to content

Commit 68a6da9

Browse files
committed
Make uuid1 and uuid4 tests conditional on whether ctypes can be imported;
implementation of either function depends on ctypes but uuid as a whole does not.
1 parent 161586c commit 68a6da9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Lib/test/test_uuid.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ def test_getnode(self):
367367
self.assertEqual(node1, node2)
368368

369369
def test_uuid1(self):
370+
# uuid1 requires ctypes.
371+
try:
372+
import ctypes
373+
except ImportError:
374+
return
375+
370376
equal = self.assertEqual
371377

372378
# Make sure uuid1() generates UUIDs that are actually version 1.
@@ -420,6 +426,12 @@ def test_uuid3(self):
420426
equal(str(u), v)
421427

422428
def test_uuid4(self):
429+
# uuid4 requires ctypes.
430+
try:
431+
import ctypes
432+
except ImportError:
433+
return
434+
423435
equal = self.assertEqual
424436

425437
# Make sure uuid4() generates UUIDs that are actually version 4.

0 commit comments

Comments
 (0)