summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-04-05 14:43:00 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-04-05 14:54:07 +0100
commitcd095ef0ee1dac13adb4d9a24260fe610e7a536f (patch)
tree64a78d20d7e76dc38108967b6ef321e30827c94e
parenta66c34a6d098623617d675191a4c82f60de1d662 (diff)
downloadpsycopg2-cd095ef0ee1dac13adb4d9a24260fe610e7a536f.tar.gz
Added test to verify callback errors in named cursors
They work fine.
-rwxr-xr-xtests/test_green.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_green.py b/tests/test_green.py
index b8fe4e1..8c1c20c 100755
--- a/tests/test_green.py
+++ b/tests/test_green.py
@@ -179,6 +179,23 @@ class CallbackErrorTestCase(ConnectingTestCase):
self.fail("you should have had a success or an error by now")
+ def test_errors_named_cursor(self):
+ for i in range(100):
+ self.to_error = None
+ cnn = self.connect()
+ cur = cnn.cursor('foo')
+ self.to_error = i
+ try:
+ cur.execute("select 1")
+ cur.fetchone()
+ except ZeroDivisionError:
+ pass
+ else:
+ # The query completed
+ return
+
+ self.fail("you should have had a success or an error by now")
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)