Changeset 844 for trunk/tests


Ignore:
Timestamp:
Feb 8, 2016, 6:15:53 PM (4 years ago)
Author:
cito
Message:

New connection attribute "closed" in pgdb

This can be useful when implementing connection pools, e.g. in SQLAlchemy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_dbapi20.py

    r843 r844  
    419419        cur.execute("select 1 union select 2 union select 3")
    420420        self.assertEqual([r[0] for r in cur], [1, 2, 3])
     421
     422    def test_cursor_invalidation(self):
     423        con = self._connect()
     424        cur = con.cursor()
     425        cur.execute("select 1 union select 2")
     426        self.assertEqual(cur.fetchone(), (1,))
     427        self.assertFalse(con.closed)
     428        con.close()
     429        self.assertTrue(con.closed)
     430        self.assertRaises(pgdb.OperationalError, cur.fetchone)
    421431
    422432    def test_fetch_2_rows(self):
Note: See TracChangeset for help on using the changeset viewer.