| 160 | |
| 161 | @gen_test |
| 162 | def test_nested_notify(self): |
| 163 | # Ensure no notifications lost, even if notify() is reentered by a |
| 164 | # waiter calling notify(). |
| 165 | c = locks.Condition() |
| 166 | |
| 167 | # Three waiters. |
| 168 | futures = [asyncio.ensure_future(c.wait()) for _ in range(3)] |
| 169 | |
| 170 | # First and second futures resolved. Second future reenters notify(), |
| 171 | # resolving third future. |
| 172 | futures[1].add_done_callback(lambda _: c.notify()) |
| 173 | c.notify(2) |
| 174 | yield |
| 175 | self.assertTrue(all(f.done() for f in futures)) |
| 176 | |
| 177 | @gen_test |
| 178 | def test_garbage_collection(self): |