MCPcopy
hub / github.com/psycopg/psycopg / test_notifies_blocking

Function test_notifies_blocking

tests/test_notify_async.py:202–219  ·  view source on GitHub ↗
(aconn)

Source from the content-addressed store, hash-verified

200@pytest.mark.slow
201@pytest.mark.timing
202async def test_notifies_blocking(aconn):
203 async def listener():
204 async for _ in aconn.notifies(timeout=1):
205 pass
206
207 worker = spawn(listener)
208 try:
209 # Make sure the listener is listening
210 if not aconn.lock.locked():
211 await asleep(0.01)
212
213 t0 = time()
214 await aconn.execute("select 1")
215 dt = time() - t0
216 finally:
217 await gather(worker)
218
219 assert dt > 0.5
220
221
222@pytest.mark.slow

Callers

nothing calls this directly

Calls 4

spawnFunction · 0.70
asleepFunction · 0.70
gatherFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected