Skip to content

Commit 12cce92

Browse files
committed
tests: Pass loop explicitly to asyncio.sleep() in test_execute*
1 parent 1b3a847 commit 12cce92

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_pool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -382,34 +382,34 @@ async def get_xact_id(con):
382382
async def test_pool_connection_methods(self):
383383
async def test_fetch(pool):
384384
i = random.randint(0, 20)
385-
await asyncio.sleep(random.random() / 100)
385+
await asyncio.sleep(random.random() / 100, loop=self.loop)
386386
r = await pool.fetch('SELECT {}::int'.format(i))
387387
self.assertEqual(r, [(i,)])
388388
return 1
389389

390390
async def test_fetchrow(pool):
391391
i = random.randint(0, 20)
392-
await asyncio.sleep(random.random() / 100)
392+
await asyncio.sleep(random.random() / 100, loop=self.loop)
393393
r = await pool.fetchrow('SELECT {}::int'.format(i))
394394
self.assertEqual(r, (i,))
395395
return 1
396396

397397
async def test_fetchval(pool):
398398
i = random.randint(0, 20)
399-
await asyncio.sleep(random.random() / 100)
399+
await asyncio.sleep(random.random() / 100, loop=self.loop)
400400
r = await pool.fetchval('SELECT {}::int'.format(i))
401401
self.assertEqual(r, i)
402402
return 1
403403

404404
async def test_execute(pool):
405-
await asyncio.sleep(random.random() / 100)
405+
await asyncio.sleep(random.random() / 100, loop=self.loop)
406406
r = await pool.execute('SELECT generate_series(0, 10)')
407407
self.assertEqual(r, 'SELECT {}'.format(11))
408408
return 1
409409

410410
async def test_execute_with_arg(pool):
411411
i = random.randint(0, 20)
412-
await asyncio.sleep(random.random() / 100)
412+
await asyncio.sleep(random.random() / 100, loop=self.loop)
413413
r = await pool.execute('SELECT generate_series(0, $1)', i)
414414
self.assertEqual(r, 'SELECT {}'.format(i + 1))
415415
return 1
@@ -431,7 +431,7 @@ async def run(N, meth):
431431

432432
async def test_pool_connection_execute_many(self):
433433
async def worker(pool):
434-
await asyncio.sleep(random.random() / 100)
434+
await asyncio.sleep(random.random() / 100, loop=self.loop)
435435
await pool.executemany('''
436436
INSERT INTO exmany VALUES($1, $2)
437437
''', [

0 commit comments

Comments
 (0)