diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/database/postgresql.py | 5 | ||||
| -rw-r--r-- | src/mailman/database/sqlite.py | 4 | ||||
| -rw-r--r-- | src/mailman/database/tests/test_migrations.py | 7 |
3 files changed, 5 insertions, 11 deletions
diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py index 1d1abca9e..4200ae4fe 100644 --- a/src/mailman/database/postgresql.py +++ b/src/mailman/database/postgresql.py @@ -43,13 +43,10 @@ class _TestDB: self.database = database def cleanup(self): - self.database.store.execute('ABORT;') + self.database.store.rollback() self.database.store.close() config.db.store.execute('DROP DATABASE mmtest;') - def abort(self): - self.database.store.execute('ABORT;') - class PostgreSQLDatabase(StormBaseDatabase): diff --git a/src/mailman/database/sqlite.py b/src/mailman/database/sqlite.py index cdee8f525..fc1037301 100644 --- a/src/mailman/database/sqlite.py +++ b/src/mailman/database/sqlite.py @@ -47,10 +47,6 @@ class _TestDB: def cleanup(self): shutil.rmtree(self._tempdir) - def abort(self): - # No abort needed. - pass - class SQLiteDatabase(StormBaseDatabase): diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py index 87f012404..595a673fc 100644 --- a/src/mailman/database/tests/test_migrations.py +++ b/src/mailman/database/tests/test_migrations.py @@ -75,19 +75,20 @@ class MigrationTestBase(unittest.TestCase): class TestMigration20120407Schema(MigrationTestBase): """Test column migrations.""" - def test_pre_upgrade_columns_base(self): + def test_pre_upgrade_columns_migration(self): # Test that before the migration, the old table columns are present # and the new database columns are not. # # Load all the migrations to just before the one we're testing. self._database.load_migrations('20120406999999') + self._database.store.commit() # Verify that the database has not yet been migrated. for missing in ('archive_policy', 'nntp_prefix_subject_too'): self.assertRaises(DatabaseError, self._database.store.execute, 'select {0} from mailinglist;'.format(missing)) - self._testdb.abort() + self._database.store.rollback() for present in ('archive', 'archive_private', 'archive_volume_frequency', @@ -122,7 +123,7 @@ class TestMigration20120407Schema(MigrationTestBase): self.assertRaises(DatabaseError, self._database.store.execute, 'select {0} from mailinglist;'.format(missing)) - self._testdb.abort() + self._database.store.rollback() |
