diff --git a/test/test_dbcore.py b/test/test_dbcore.py index 80d85c3bb4..8450b02770 100644 --- a/test/test_dbcore.py +++ b/test/test_dbcore.py @@ -190,6 +190,7 @@ def test_open_with_same_fields_leaves_untouched(self): c = new_lib._connection().cursor() c.execute("select * from test") row = c.fetchone() + c.connection.close() self.assertEqual(len(row.keys()), len(ModelFixture2._fields)) def test_open_with_new_field_adds_column(self): @@ -197,6 +198,7 @@ def test_open_with_new_field_adds_column(self): c = new_lib._connection().cursor() c.execute("select * from test") row = c.fetchone() + c.connection.close() self.assertEqual(len(row.keys()), len(ModelFixture3._fields)) def test_open_with_fewer_fields_leaves_untouched(self): @@ -204,6 +206,7 @@ def test_open_with_fewer_fields_leaves_untouched(self): c = new_lib._connection().cursor() c.execute("select * from test") row = c.fetchone() + c.connection.close() self.assertEqual(len(row.keys()), len(ModelFixture2._fields)) def test_open_with_multiple_new_fields(self): @@ -211,12 +214,15 @@ def test_open_with_multiple_new_fields(self): c = new_lib._connection().cursor() c.execute("select * from test") row = c.fetchone() + c.connection.close() self.assertEqual(len(row.keys()), len(ModelFixture4._fields)) def test_extra_model_adds_table(self): new_lib = DatabaseFixtureTwoModels(self.libfile) try: - new_lib._connection().execute("select * from another") + c = new_lib._connection() + c.execute("select * from another") + c.close() except sqlite3.OperationalError: self.fail("select failed")