MCPcopy Index your code
hub / github.com/RustPython/RustPython / testIssue8621

Method testIssue8621

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

Source from the content-addressed store, hash-verified

1114
1115 @support.requires_fork()
1116 def testIssue8621(self):
1117 # On at least some versions of OSX self.uuid.uuid4 generates
1118 # the same sequence of UUIDs in the parent and any
1119 # children started using fork.
1120 fds = os.pipe()
1121 pid = os.fork()
1122 if pid == 0:
1123 os.close(fds[0])
1124 value = self.uuid.uuid4()
1125 os.write(fds[1], value.hex.encode('latin-1'))
1126 os._exit(0)
1127
1128 else:
1129 os.close(fds[1])
1130 self.addCleanup(os.close, fds[0])
1131 parent_value = self.uuid.uuid4().hex
1132 support.wait_process(pid, exitcode=0)
1133 child_value = os.read(fds[0], 100).decode('latin-1')
1134
1135 self.assertNotEqual(parent_value, child_value)
1136
1137 def test_uuid_weakref(self):
1138 # 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