diff options
| author | Barry Warsaw | 2011-05-15 12:19:25 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-05-15 12:19:25 -0400 |
| commit | b8e977bfe7b144c690c30a4bc0b94d74a35faeac (patch) | |
| tree | 069e91e7b1a436336eb23683bbb0fd474924fab4 /src/mailman/testing/helpers.py | |
| parent | 091917126e7c58657310524882743e8391166fc3 (diff) | |
| parent | 9d30e3d7f584093fd30d2cbdd1124b4d49adb132 (diff) | |
| download | mailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.tar.gz mailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.tar.zst mailman-b8e977bfe7b144c690c30a4bc0b94d74a35faeac.zip | |
Merge current bounces work.
Diffstat (limited to 'src/mailman/testing/helpers.py')
| -rw-r--r-- | src/mailman/testing/helpers.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index 71cddd0f4..9f9ea6181 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -63,7 +63,7 @@ from mailman.utilities.mailbox import Mailbox -def make_testable_runner(runner_class, name=None): +def make_testable_runner(runner_class, name=None, predicate=None): """Create a queue runner that runs until its queue is empty. :param runner_class: The queue runner's class. @@ -71,6 +71,10 @@ def make_testable_runner(runner_class, name=None): :param name: Optional queue name; if not given, it is calculated from the class name. :type name: string or None + :param predicate: Optional alternative predicate for deciding when to stop + the queue runner. When None (the default) it stops when the queue is + empty. + :type predicate: callable that gets one argument, the queue runner. :return: A runner instance. """ @@ -90,7 +94,10 @@ def make_testable_runner(runner_class, name=None): def _do_periodic(self): """Stop when the queue is empty.""" - self._stop = (len(self.switchboard.files) == 0) + if predicate is None: + self._stop = (len(self.switchboard.files) == 0) + else: + self._stop = predicate(self) return EmptyingRunner(name) |
