Changeset 886 for trunk/tests


Ignore:
Timestamp:
Sep 8, 2016, 12:04:53 PM (3 years ago)
Author:
cito
Message:

Fix infinite recursion issue

The getattr method assumes that the "db" attribute is always set
(either to None or to the underlying connection). We ensure this
by setting the class attribute "db" to None.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_classic_dbwrapper.py

    r883 r886  
    165165            method = getattr(a, method)
    166166            self.assertRaises(TypeError, method, a)
     167
     168
     169class TestDBClassInit(unittest.TestCase):
     170    """Test proper handling of errors when creating DB instances."""
     171
     172    def testBadParams(self):
     173        self.assertRaises(TypeError, pg.DB, invalid=True)
     174
     175    def testDeleteDb(self):
     176        db = DB()
     177        del db.db
     178        self.assertRaises(pg.InternalError, db.close)
     179        del db
    167180
    168181
Note: See TracChangeset for help on using the changeset viewer.