diff options
| author | Barry Warsaw | 2012-07-25 21:50:42 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-07-25 21:50:42 -0400 |
| commit | fc7e14405afd9a89ae1b6cc8cabd861ec4e72ee8 (patch) | |
| tree | 9d4d13881af752fb42d6389fccf2fc10ce9c4881 /src/mailman/database/postgresql.py | |
| parent | 12b1c4ca12668e6269d367886f8141005ae8c112 (diff) | |
| download | mailman-fc7e14405afd9a89ae1b6cc8cabd861ec4e72ee8.tar.gz mailman-fc7e14405afd9a89ae1b6cc8cabd861ec4e72ee8.tar.zst mailman-fc7e14405afd9a89ae1b6cc8cabd861ec4e72ee8.zip | |
Diffstat (limited to 'src/mailman/database/postgresql.py')
| -rw-r--r-- | src/mailman/database/postgresql.py | 39 |
1 files changed, 1 insertions, 38 deletions
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,29 +26,11 @@ __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) |
