summaryrefslogtreecommitdiff
path: root/src/mailman/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/database')
-rw-r--r--src/mailman/database/base.py2
-rw-r--r--src/mailman/database/tests/test_migrations.py21
2 files changed, 17 insertions, 6 deletions
diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py
index 934e62411..881129093 100644
--- a/src/mailman/database/base.py
+++ b/src/mailman/database/base.py
@@ -115,7 +115,7 @@ class SABaseDatabase:
# XXX This can all be removed once SQLAlchemy 1.2 is released, and we
# pass `pool_pre_ping=True` to create_engine().
@event.listens_for(self.engine, 'engine_connect') # noqa: E306
- def ping_connection(connection, branch): # pragma: no cover
+ def ping_connection(connection, branch): # pragma: nocover
if branch:
# "branch" refers to a sub-connection of a connection;
# we don't want to bother pinging on these.
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index b5d17d6db..ce1bc101b 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -35,6 +35,7 @@ from mailman.interfaces.member import MemberRole
from mailman.interfaces.template import ITemplateManager
from mailman.interfaces.usermanager import IUserManager
from mailman.testing.layers import ConfigLayer
+from warnings import catch_warnings, simplefilter
from zope.component import getUtility
@@ -63,11 +64,21 @@ class TestMigrations(unittest.TestCase):
def test_all_migrations(self):
script_dir = alembic.script.ScriptDirectory.from_config(alembic_cfg)
revisions = [sc.revision for sc in script_dir.walk_revisions()]
- for revision in revisions:
- alembic.command.downgrade(alembic_cfg, revision)
- revisions.reverse()
- for revision in revisions:
- alembic.command.upgrade(alembic_cfg, revision)
+ with catch_warnings():
+ simplefilter('ignore', UserWarning)
+ # Alembic/SQLite does not like something about these migrations.
+ # They're more or less inconsequential in practice (since users
+ # will rarely if ever downgrade their database), but it does
+ # clutter up the test output, so just suppress the warning.
+ #
+ # E.g.
+ # alembic/util/messaging.py:69: UserWarning:
+ # Skipping unsupported ALTER for creation of implicit constraint
+ for revision in revisions:
+ alembic.command.downgrade(alembic_cfg, revision)
+ revisions.reverse()
+ for revision in revisions:
+ alembic.command.upgrade(alembic_cfg, revision)
def test_42756496720_header_matches(self):
test_header_matches = [