From fc7e14405afd9a89ae1b6cc8cabd861ec4e72ee8 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 25 Jul 2012 21:50:42 -0400 Subject: Fix resetting PostgreSQL databases, thus making the full test suite pass with them. --- src/mailman/database/postgresql.py | 39 +------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'src/mailman/database/postgresql.py') diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py index 4200ae4fe..1fb831b3b 100644 --- a/src/mailman/database/postgresql.py +++ b/src/mailman/database/postgresql.py @@ -17,7 +17,7 @@ """PostgreSQL database support.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -26,28 +26,10 @@ __all__ = [ from operator import attrgetter -from urlparse import urlsplit, urlunsplit -from mailman.config import config from mailman.database.base import StormBaseDatabase - - -class _TestDB: - # For the test suite; bool column values. - TRUE = 'True' - FALSE = 'False' - - def __init__(self, database): - self.database = database - - def cleanup(self): - self.database.store.rollback() - self.database.store.close() - config.db.store.execute('DROP DATABASE mmtest;') - - class PostgreSQLDatabase(StormBaseDatabase): """Database class for PostgreSQL.""" @@ -81,22 +63,3 @@ class PostgreSQLDatabase(StormBaseDatabase): max("id") IS NOT null) FROM "{0}"; """.format(model_class.__storm_table__)) - - @staticmethod - def _make_testdb(): - from mailman.testing.helpers import configuration - parts = urlsplit(config.database.url) - assert parts.scheme == 'postgres' - new_parts = list(parts) - new_parts[2] = '/mmtest' - url = urlunsplit(new_parts) - # Use the existing database connection to create a new testing - # database. Create a savepoint, which will make it easy to reset - # after the test. - config.db.store.execute('ABORT;') - config.db.store.execute('CREATE DATABASE mmtest;') - # Now create a new, test database. - database = PostgreSQLDatabase() - with configuration('database', url=url): - database.initialize() - return _TestDB(database) -- cgit v1.2.3-70-g09d2