MCPcopy Index your code
hub / github.com/python/cpython / testIssue8621

Method testIssue8621

Lib/test/test_uuid.py:1122–1141  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1120 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
1121 @support.requires_fork()
1122 def testIssue8621(self):
1123 # On at least some versions of OSX self.uuid.uuid4 generates
1124 # the same sequence of UUIDs in the parent and any
1125 # children started using fork.
1126 fds = os.pipe()
1127 pid = os.fork()
1128 if pid == 0:
1129 os.close(fds[0])
1130 value = self.uuid.uuid4()
1131 os.write(fds[1], value.hex.encode('latin-1'))
1132 os._exit(0)
1133
1134 else:
1135 os.close(fds[1])
1136 self.addCleanup(os.close, fds[0])
1137 parent_value = self.uuid.uuid4().hex
1138 support.wait_process(pid, exitcode=0)
1139 child_value = os.read(fds[0], 100).decode('latin-1')
1140
1141 self.assertNotEqual(parent_value, child_value)
1142
1143 def test_uuid_weakref(self):
1144 # bpo-35701: check that weak referencing to a UUID object can be created

Callers

nothing calls this directly

Calls 9

addCleanupMethod · 0.80
assertNotEqualMethod · 0.80
pipeMethod · 0.45
closeMethod · 0.45
writeMethod · 0.45
encodeMethod · 0.45
_exitMethod · 0.45
decodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected