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

Delta Between Two Patch Sets: Lib/test/test_uuid.py

Issue 20519: ctypes.create_string_buffer creates reference cycles
Left Patch Set: Created 5 years, 7 months ago
Right Patch Set: Created 3 years, 10 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:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Lib/uuid.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 import unittest 1 import unittest
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 uuid 7 import uuid
8 8
9 def importable(name): 9 def importable(name):
10 try: 10 try:
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 def test_random_getnode(self): 333 def test_random_getnode(self):
334 node = uuid._random_getnode() 334 node = uuid._random_getnode()
335 # Least significant bit of first octet must be set. 335 # Least significant bit of first octet must be set.
336 self.assertTrue(node & 0x010000000000) 336 self.assertTrue(node & 0x010000000000)
337 self.assertTrue(node < (1 << 48)) 337 self.assertTrue(node < (1 << 48))
338 338
339 @unittest.skipUnless(os.name == 'posix', 'requires Posix') 339 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
340 @unittest.skipUnless(importable('ctypes'), 'requires ctypes') 340 @unittest.skipUnless(importable('ctypes'), 'requires ctypes')
341 def test_unixdll_getnode(self): 341 def test_unixdll_getnode(self):
342 if uuid._uuid is not None:
343 self.skipTest("_uuid extension was imported, ctypes not used")
342 try: # Issues 1481, 3581: _uuid_generate_time() might be None. 344 try: # Issues 1481, 3581: _uuid_generate_time() might be None.
343 self.check_node(uuid._unixdll_getnode(), 'unixdll') 345 self.check_node(uuid._unixdll_getnode(), 'unixdll')
344 except TypeError: 346 except TypeError:
345 pass 347 pass
348
349 @unittest.skipUnless(os.name == 'posix', 'requires Posix')
350 def test_unix_extmod_getnode(self):
351 if uuid._uuid is None:
352 self.skipTest("_uuid extension was not imported")
353 self.check_node(uuid._unix_extmod_getnode(), 'unix_extmod')
346 354
347 @unittest.skipUnless(os.name == 'nt', 'requires Windows') 355 @unittest.skipUnless(os.name == 'nt', 'requires Windows')
348 @unittest.skipUnless(importable('ctypes'), 'requires ctypes') 356 @unittest.skipUnless(importable('ctypes'), 'requires ctypes')
349 def test_windll_getnode(self): 357 def test_windll_getnode(self):
350 self.check_node(uuid._windll_getnode(), 'windll') 358 self.check_node(uuid._windll_getnode(), 'windll')
351 359
352 def test_getnode(self): 360 def test_getnode(self):
353 node1 = uuid.getnode() 361 node1 = uuid.getnode()
354 self.check_node(node1, "getnode1") 362 self.check_node(node1, "getnode1")
355 363
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 self.addCleanup(os.close, fds[0]) 497 self.addCleanup(os.close, fds[0])
490 parent_value = uuid.uuid4().hex 498 parent_value = uuid.uuid4().hex
491 os.waitpid(pid, 0) 499 os.waitpid(pid, 0)
492 child_value = os.read(fds[0], 100).decode('latin-1') 500 child_value = os.read(fds[0], 100).decode('latin-1')
493 501
494 self.assertNotEqual(parent_value, child_value) 502 self.assertNotEqual(parent_value, child_value)
495 503
496 504
497 if __name__ == '__main__': 505 if __name__ == '__main__':
498 unittest.main() 506 unittest.main()
LEFTRIGHT
« no previous file | Lib/uuid.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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