summaryrefslogtreecommitdiff
path: root/src/mailman/testing/helpers.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-07-20 20:47:26 -0400
committerBarry Warsaw2012-07-20 20:47:26 -0400
commit27672b5c94c78fecbda8cf91bb62618b7a0dc7cb (patch)
treef982344c91b096d6bfcb848147a5059b5ab0c0a1 /src/mailman/testing/helpers.py
parente1aa901fbdcc6d7fbb495a1d9ca1a5079008164a (diff)
parent01415190ab44e69a8f09a6411564a7cb288404e8 (diff)
downloadmailman-27672b5c94c78fecbda8cf91bb62618b7a0dc7cb.tar.gz
mailman-27672b5c94c78fecbda8cf91bb62618b7a0dc7cb.tar.zst
mailman-27672b5c94c78fecbda8cf91bb62618b7a0dc7cb.zip
Diffstat (limited to 'src/mailman/testing/helpers.py')
-rw-r--r--src/mailman/testing/helpers.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index 4091c1cd6..054dd4ff7 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -345,14 +345,14 @@ def call_api(url, data=None, method=None, username=None, password=None):
@contextmanager
def event_subscribers(*subscribers):
- """Temporarily set the Zope event subscribers list.
+ """Temporarily extend the Zope event subscribers list.
:param subscribers: A sequence of event subscribers.
:type subscribers: sequence of callables, each receiving one argument, the
event.
"""
old_subscribers = event.subscribers[:]
- event.subscribers = list(subscribers)
+ event.subscribers.extend(subscribers)
try:
yield
finally:
@@ -365,8 +365,14 @@ class configuration:
def __init__(self, section, **kws):
self._section = section
+ # Most tests don't care about the name given to the temporary
+ # configuration. Usually we'll just craft a random one, but some
+ # tests do care, so give them a hook to set it.
+ if '_configname' in kws:
+ self._uuid = kws.pop('_configname')
+ else:
+ self._uuid = uuid.uuid4().hex
self._values = kws.copy()
- self._uuid = uuid.uuid4().hex
def _apply(self):
lines = ['[{0}]'.format(self._section)]