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

bpo-37244: Fix test_multiprocessing.test_resource_tracker() (GH-14288)

Increase robustness of test_resource_tracker(): retry for 60 seconds.
parent 594d9b9f
...@@ -5010,12 +5010,21 @@ class TestResourceTracker(unittest.TestCase): ...@@ -5010,12 +5010,21 @@ class TestResourceTracker(unittest.TestCase):
_resource_unlink(name1, rtype) _resource_unlink(name1, rtype)
p.terminate() p.terminate()
p.wait() p.wait()
time.sleep(2.0)
with self.assertRaises(OSError) as ctx: deadline = time.monotonic() + 60
_resource_unlink(name2, rtype) while time.monotonic() < deadline:
# docs say it should be ENOENT, but OSX seems to give EINVAL time.sleep(.5)
self.assertIn( try:
ctx.exception.errno, (errno.ENOENT, errno.EINVAL)) _resource_unlink(name2, rtype)
except OSError as e:
# docs say it should be ENOENT, but OSX seems to give
# EINVAL
self.assertIn(e.errno, (errno.ENOENT, errno.EINVAL))
break
else:
raise AssertionError(
f"A {rtype} resource was leaked after a process was "
f"abruptly terminated.")
err = p.stderr.read().decode('utf-8') err = p.stderr.read().decode('utf-8')
p.stderr.close() p.stderr.close()
expected = ('resource_tracker: There appear to be 2 leaked {} ' expected = ('resource_tracker: There appear to be 2 leaked {} '
......
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