Commit 96d94c21 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

fix race conditions

parent ade01774
......@@ -1628,6 +1628,7 @@ class ManagerTestCase(unittest.TestCase):
conditions[id].wait()
actual_lst.append(("stop", id))
@asyncio.coroutine
def _process(id, reset, rescheduled):
with lock:
self.assertNotIn(id, conditions)
......@@ -1917,9 +1918,9 @@ class ManagerTestCase(unittest.TestCase):
rescheduled[id] = rsc_fut
return fut.result()
manager = controller.Manager(2)
manager._process = lambda *k: manager.run_in_executor(worker, *k)
manager._process = asyncio.coroutine(
lambda *k: manager.run_in_executor(worker, *k))
@asyncio.coroutine
......@@ -1957,6 +1958,8 @@ class ManagerTestCase(unittest.TestCase):
yield from asyncio.wait_for(fut, timeout=.1)
self.assertEquals(fut.result(), 43)
self.assertFalse(fut2.done())
yield from asyncio.sleep(.1)
# since the task is restarted, the 'rescheduled' is recreated
self.assertFalse(rescheduled[2].done())
......
Supports Markdown
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