MCPcopy
hub / github.com/tornadoweb/tornado / test_nested_notify

Method test_nested_notify

tornado/test/locks_test.py:162–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 4

waitMethod · 0.95
notifyMethod · 0.95
allFunction · 0.85
doneMethod · 0.45

Tested by

no test coverage detected