summaryrefslogtreecommitdiff
path: root/src/mailman/database
diff options
context:
space:
mode:
authorBarry Warsaw2016-04-30 13:34:04 -0400
committerGitLab2016-04-30 19:54:54 +0000
commitc6eb7ee3e574b48ee016dd31af2014b0ed083268 (patch)
tree14c1f1e7bb382898ee50909333365aab335aa4a1 /src/mailman/database
parent465f24ff33e154385322ee894d32d8b7dd9b3941 (diff)
downloadmailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.tar.gz
mailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.tar.zst
mailman-c6eb7ee3e574b48ee016dd31af2014b0ed083268.zip
Diffstat (limited to 'src/mailman/database')
-rw-r--r--src/mailman/database/tests/test_factory.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mailman/database/tests/test_factory.py b/src/mailman/database/tests/test_factory.py
index d8593cc76..74b45e43a 100644
--- a/src/mailman/database/tests/test_factory.py
+++ b/src/mailman/database/tests/test_factory.py
@@ -20,6 +20,7 @@
import unittest
import alembic.command
+from contextlib import suppress
from mailman.config import config
from mailman.database.alembic import alembic_cfg
from mailman.database.factory import LAST_STORM_SCHEMA_VERSION, SchemaManager
@@ -87,12 +88,10 @@ class TestSchemaManager(unittest.TestCase):
version = Model.metadata.tables['version']
version.drop(config.db.engine, checkfirst=True)
Model.metadata.remove(version)
- try:
+ # If it's nonexistent, PostgreSQL raises a ProgrammingError, while
+ # SQLite raises an OperationalError.
+ with suppress(ProgrammingError, OperationalError):
Index('ix_user_user_id').drop(bind=config.db.engine)
- except (ProgrammingError, OperationalError):
- # Nonexistent. PostgreSQL raises a ProgrammingError, while SQLite
- # raises an OperationalError.
- pass
config.db.commit()
def test_current_database(self):