From cd095ef0ee1dac13adb4d9a24260fe610e7a536f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 5 Apr 2017 14:43:00 +0100 Subject: [PATCH] Added test to verify callback errors in named cursors They work fine. --- tests/test_green.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_green.py b/tests/test_green.py index b8fe4e13..8c1c20ce 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__)