diff options
Diffstat (limited to 'tests/test_cursor.py')
-rw-r--r-- | tests/test_cursor.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py new file mode 100644 index 0000000..38c368a --- /dev/null +++ b/tests/test_cursor.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import unittest +import psycopg2 +import psycopg2.extensions +import tests + +class CursorTests(unittest.TestCase): + + def connect(self): + return psycopg2.connect(tests.dsn) + + def test_executemany_propagate_exceptions(self): + conn = self.connect() + cur = conn.cursor() + cur.execute("create temp table test_exc (data int);") + def buggygen(): + yield 1/0 + self.assertRaises(ZeroDivisionError, + cur.executemany, "insert into test_exc values (%s)", buggygen()) + cur.close() + conn.close() + + +def test_suite(): + return unittest.TestLoader().loadTestsFromName(__name__) + +if __name__ == "__main__": + unittest.main() |