MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / test_copy_to_table_timeout

Method test_copy_to_table_timeout

tests/test_copy.py:555–582  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

553 await self.con.execute('DROP TABLE copytab')
554
555 async def test_copy_to_table_timeout(self):
556 await self.con.execute('''
557 CREATE TABLE copytab(a text, b text);
558 ''')
559
560 try:
561 class _Source:
562 def __init__(self, loop):
563 self.rowcount = 0
564 self.loop = loop
565
566 def __aiter__(self):
567 return self
568
569 async def __anext__(self):
570 self.rowcount += 1
571 await asyncio.sleep(60)
572 return b'a1' * 50 + b'\t' + b'b1' * 50 + b'\n'
573
574 with self.assertRaises(asyncio.TimeoutError):
575 await self.con.copy_to_table(
576 'copytab', source=_Source(self.loop), timeout=0.10)
577
578 # Check that the protocol has recovered.
579 self.assertEqual(await self.con.fetchval('SELECT 1'), 1)
580
581 finally:
582 await self.con.execute('DROP TABLE copytab')
583
584 async def test_copy_to_table_from_file_path(self):
585 await self.con.execute('''

Callers

nothing calls this directly

Calls 4

_SourceClass · 0.85
executeMethod · 0.45
copy_to_tableMethod · 0.45
fetchvalMethod · 0.45

Tested by

no test coverage detected