Commit 1d333d66 authored by Aurélien Bompard's avatar Aurélien Bompard

Make it possible to run the setup/teardown methods more than once per test run

parent 2e2d2a60
......@@ -102,7 +102,8 @@ class FakeConnection(mailmanclient._client._Connection):
except HTTPError:
except IOError:
raise MailmanConnectionError('Could not connect to Mailman API')
raise mailmanclient.MailmanConnectionError(
'Could not connect to Mailman API')
......@@ -126,4 +127,18 @@ class FakeMailmanClient(mailmanclient.Client):
def tearDown(self):
config.create_paths = False # or ConfigLayer.tearDown will create them
def reset_mailman_config():
# This is necessary because ConfigLayer.setup/tearDown was designed to be
# run only once for the whole test suite, and thus does not reset
# everything afterwards
for prop in ("switchboards", "rules", "chains", "handlers",
"pipelines", "commands"):
getattr(config, prop).clear()
from mailman.model.user import uid_factory
uid_factory._lockobj = None
from mailman.model.member import uid_factory
uid_factory._lockobj = None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment