mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Added test to verify callback errors in named cursors
They work fine.
This commit is contained in:
parent
a66c34a6d0
commit
cd095ef0ee
|
@ -179,6 +179,23 @@ class CallbackErrorTestCase(ConnectingTestCase):
|
||||||
|
|
||||||
self.fail("you should have had a success or an error by now")
|
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():
|
def test_suite():
|
||||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user