From 7a301a2c45aa42c022298944c2a7786a05421e9d Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Tue, 9 Sep 2014 22:18:39 +0900 Subject: [PATCH] Exception raised from _mysql should be reraise as is. --- tests/test_MySQLdb_capabilities.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_MySQLdb_capabilities.py b/tests/test_MySQLdb_capabilities.py index c45353f..6f46ea9 100644 --- a/tests/test_MySQLdb_capabilities.py +++ b/tests/test_MySQLdb_capabilities.py @@ -92,7 +92,16 @@ class test_MySQLdb(capabilities.DatabaseTest): def test_ping(self): self.connection.ping() - + + def test_reraise_exception(self): + c = self.cursor + try: + c.execute("SELECT x FROM not_existing_table") + except MySQLdb.ProgrammingError as e: + self.assertEqual(e.args[0], 1146) + return + self.fail("Should raise ProgrammingError") + if __name__ == '__main__': if test_MySQLdb.leak_test: