MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_connection_use_after_close

Method test_connection_use_after_close

tests/test_connect.py:1790–1819  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1788 self.assertFalse(isinstance(self.con, list))
1789
1790 async def test_connection_use_after_close(self):
1791 def check():
1792 return self.assertRaisesRegex(asyncpg.InterfaceError,
1793 'connection is closed')
1794
1795 await self.con.close()
1796
1797 with check():
1798 await self.con.add_listener('aaa', lambda: None)
1799
1800 with check():
1801 self.con.transaction()
1802
1803 with check():
1804 await self.con.executemany('SELECT 1', [])
1805
1806 with check():
1807 await self.con.set_type_codec('aaa', encoder=None, decoder=None)
1808
1809 with check():
1810 await self.con.set_builtin_type_codec('aaa', codec_name='aaa')
1811
1812 for meth in ('execute', 'fetch', 'fetchval', 'fetchrow',
1813 'prepare', 'cursor'):
1814
1815 with check():
1816 await getattr(self.con, meth)('SELECT 1')
1817
1818 with check():
1819 await self.con.reset()
1820
1821 @unittest.skipIf(os.environ.get('PGHOST'), 'unmanaged cluster')
1822 async def test_connection_ssl_to_no_ssl_server(self):

Callers

nothing calls this directly

Calls 7

add_listenerMethod · 0.80
transactionMethod · 0.80
set_type_codecMethod · 0.80
closeMethod · 0.45
executemanyMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected