mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Added test to verify withhold cursors work in autocommit
This commit is contained in:
parent
478e66f761
commit
c81522079e
|
@ -235,6 +235,28 @@ class CursorTests(ConnectingTestCase):
|
|||
self.assertEqual(self.conn.get_transaction_status(),
|
||||
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
|
||||
|
||||
def test_withhold_autocommit(self):
|
||||
self._create_withhold_table()
|
||||
self.conn.commit()
|
||||
self.conn.autocommit = True
|
||||
curs = self.conn.cursor("w", withhold=True)
|
||||
curs.execute("select data from withhold order by data")
|
||||
|
||||
self.assertEqual(curs.fetchone(), (10,))
|
||||
self.assertEqual(self.conn.status, psycopg2.extensions.STATUS_READY)
|
||||
self.assertEqual(self.conn.get_transaction_status(),
|
||||
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
|
||||
|
||||
self.conn.commit()
|
||||
self.assertEqual(self.conn.status, psycopg2.extensions.STATUS_READY)
|
||||
self.assertEqual(self.conn.get_transaction_status(),
|
||||
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
|
||||
|
||||
curs.close()
|
||||
self.assertEqual(self.conn.status, psycopg2.extensions.STATUS_READY)
|
||||
self.assertEqual(self.conn.get_transaction_status(),
|
||||
psycopg2.extensions.TRANSACTION_STATUS_IDLE)
|
||||
|
||||
def test_scrollable(self):
|
||||
self.assertRaises(psycopg2.ProgrammingError, self.conn.cursor,
|
||||
scrollable=True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user