Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(108554)

Side by Side Diff: Lib/test/test_uuid.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_urllib2net.py ('k') | Lib/test/test_venv.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import unittest.mock 1 import unittest.mock
2 from test import support 2 from test import support
3 import builtins 3 import builtins
4 import io 4 import io
5 import os 5 import os
6 import shutil 6 import shutil
7 import subprocess 7 import subprocess
8 import uuid 8 import uuid
9 9
10 def importable(name): 10 def importable(name):
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 '1447fa61-5277-5fef-a9b3-fbc6e44f4af3'), 381 '1447fa61-5277-5fef-a9b3-fbc6e44f4af3'),
382 (uuid.uuid5(uuid.NAMESPACE_X500, 'c=ca'), 382 (uuid.uuid5(uuid.NAMESPACE_X500, 'c=ca'),
383 'cc957dd1-a972-5349-98cd-874190002798'), 383 'cc957dd1-a972-5349-98cd-874190002798'),
384 ]: 384 ]:
385 equal(u.variant, uuid.RFC_4122) 385 equal(u.variant, uuid.RFC_4122)
386 equal(u.version, 5) 386 equal(u.version, 5)
387 equal(u, uuid.UUID(v)) 387 equal(u, uuid.UUID(v))
388 equal(str(u), v) 388 equal(str(u), v)
389 389
390 @unittest.skipUnless(os.name == 'posix', 'requires Posix') 390 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
391 @unittest.skipUnless(hasattr(os, 'fork'), "test requires os.fork()")
391 def testIssue8621(self): 392 def testIssue8621(self):
392 # On at least some versions of OSX uuid.uuid4 generates 393 # On at least some versions of OSX uuid.uuid4 generates
393 # the same sequence of UUIDs in the parent and any 394 # the same sequence of UUIDs in the parent and any
394 # children started using fork. 395 # children started using fork.
395 fds = os.pipe() 396 fds = os.pipe()
396 pid = os.fork() 397 pid = os.fork()
397 if pid == 0: 398 if pid == 0:
398 os.close(fds[0]) 399 os.close(fds[0])
399 value = uuid.uuid4() 400 value = uuid.uuid4()
400 os.write(fds[1], value.hex.encode('latin-1')) 401 os.write(fds[1], value.hex.encode('latin-1'))
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if support.verbose >= 2: 443 if support.verbose >= 2:
443 print(hex, end=' ') 444 print(hex, end=' ')
444 if network: 445 if network:
445 # 47 bit will never be set in IEEE 802 addresses obtained 446 # 47 bit will never be set in IEEE 802 addresses obtained
446 # from network cards. 447 # from network cards.
447 self.assertFalse(node & 0x010000000000, hex) 448 self.assertFalse(node & 0x010000000000, hex)
448 self.assertTrue(0 < node < (1 << 48), 449 self.assertTrue(0 < node < (1 << 48),
449 "%s is not an RFC 4122 node ID" % hex) 450 "%s is not an RFC 4122 node ID" % hex)
450 451
451 @unittest.skipUnless(os.name == 'posix', 'requires Posix') 452 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
453 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
452 def test_ifconfig_getnode(self): 454 def test_ifconfig_getnode(self):
453 node = uuid._ifconfig_getnode() 455 node = uuid._ifconfig_getnode()
454 self.check_node(node, 'ifconfig', True) 456 self.check_node(node, 'ifconfig', True)
455 457
456 @unittest.skipUnless(os.name == 'posix', 'requires Posix') 458 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
457 def test_ip_getnode(self): 459 def test_ip_getnode(self):
458 node = uuid._ip_getnode() 460 node = uuid._ip_getnode()
459 self.check_node(node, 'ip', True) 461 self.check_node(node, 'ip', True)
460 462
461 @unittest.skipUnless(os.name == 'posix', 'requires Posix') 463 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 503
502 @unittest.skipUnless(os.name == 'nt', 'requires Windows') 504 @unittest.skipUnless(os.name == 'nt', 'requires Windows')
503 @unittest.skipUnless(importable('ctypes'), 'requires ctypes') 505 @unittest.skipUnless(importable('ctypes'), 'requires ctypes')
504 def test_windll_getnode(self): 506 def test_windll_getnode(self):
505 node = uuid._windll_getnode() 507 node = uuid._windll_getnode()
506 self.check_node(node) 508 self.check_node(node)
507 509
508 510
509 if __name__ == '__main__': 511 if __name__ == '__main__':
510 unittest.main() 512 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_urllib2net.py ('k') | Lib/test/test_venv.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+