Commit cbe72d84 authored by Pierre Glaser's avatar Pierre Glaser Committed by Victor Stinner

bpo-36867: _test_multiprocessing: avoid weak sync primitive (GH-13292)

Avoid weak sync primitive in multiprocessing resource_tracker test.
parent 3ea702ec
......@@ -3945,11 +3945,19 @@ class _TestSharedMemory(BaseTestCase):
# segment should not leak the given memory segment.
p.terminate()
p.wait()
time.sleep(1.0) # wait for the OS to collect the segment
# The shared memory file was deleted.
with self.assertRaises(FileNotFoundError):
smm = shared_memory.SharedMemory(name, create=False)
deadline = time.monotonic() + 60
t = 0.1
while time.monotonic() < deadline:
time.sleep(t)
t = min(t*2, 5)
try:
smm = shared_memory.SharedMemory(name, create=False)
except FileNotFoundError:
break
else:
raise AssertionError("A SharedMemory segment was leaked after"
" a process was abruptly terminated.")
if os.name == 'posix':
# A warning was emitted by the subprocess' own
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment