summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/runners/tests/test_confirm.py11
-rw-r--r--src/mailman/runners/tests/test_lmtp.py6
2 files changed, 9 insertions, 8 deletions
diff --git a/src/mailman/runners/tests/test_confirm.py b/src/mailman/runners/tests/test_confirm.py
index d2b24a2d1..62171979c 100644
--- a/src/mailman/runners/tests/test_confirm.py
+++ b/src/mailman/runners/tests/test_confirm.py
@@ -32,6 +32,7 @@ from zope.component import getUtility
from mailman.app.lifecycle import create_list
from mailman.config import config
+from mailman.database.transaction import transaction
from mailman.interfaces.registrar import IRegistrar
from mailman.interfaces.usermanager import IUserManager
from mailman.runners.command import CommandRunner
@@ -50,14 +51,14 @@ class TestConfirm(unittest.TestCase):
layer = ConfigLayer
def setUp(self):
- # Register a subscription requiring confirmation.
registrar = getUtility(IRegistrar)
- self._mlist = create_list('test@example.com')
- self._mlist.send_welcome_message = False
- self._token = registrar.register(self._mlist, 'anne@example.org')
self._commandq = config.switchboards['command']
self._runner = make_testable_runner(CommandRunner, 'command')
- config.db.commit()
+ with transaction():
+ # Register a subscription requiring confirmation.
+ self._mlist = create_list('test@example.com')
+ self._mlist.send_welcome_message = False
+ self._token = registrar.register(self._mlist, 'anne@example.org')
def test_confirm_with_re_prefix(self):
subject = 'Re: confirm {0}'.format(self._token)
diff --git a/src/mailman/runners/tests/test_lmtp.py b/src/mailman/runners/tests/test_lmtp.py
index 87b69c7e4..46d4ed986 100644
--- a/src/mailman/runners/tests/test_lmtp.py
+++ b/src/mailman/runners/tests/test_lmtp.py
@@ -31,7 +31,7 @@ import unittest
from datetime import datetime
from mailman.app.lifecycle import create_list
-from mailman.config import config
+from mailman.database.transaction import transaction
from mailman.testing.helpers import get_lmtp_client, get_queue_messages
from mailman.testing.layers import LMTPLayer
@@ -43,8 +43,8 @@ class TestLMTP(unittest.TestCase):
layer = LMTPLayer
def setUp(self):
- self._mlist = create_list('test@example.com')
- config.db.commit()
+ with transaction():
+ self._mlist = create_list('test@example.com')
self._lmtp = get_lmtp_client(quiet=True)
self._lmtp.lhlo('remote.example.org')