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

Method test_error_logging

tests/test_logging.py:40–51  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 self.assertEqual(len(self.con._query_loggers), 0)
39
40 async def test_error_logging(self):
41 log = LogCollector()
42 with self.con.query_logger(log):
43 with self.assertRaises(exceptions.UndefinedColumnError):
44 await self.con.execute("SELECT x")
45
46 await asyncio.sleep(0) # wait for logging
47 self.assertEqual(len(log.records), 1)
48 self.assertEqual(
49 type(log.records[0].exception),
50 exceptions.UndefinedColumnError
51 )

Callers

nothing calls this directly

Calls 3

LogCollectorClass · 0.85
query_loggerMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected