From a8b8be8ad7510c095c3232c25f2c2e3e54d44352 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 16 Oct 2011 15:31:28 -0400 Subject: * `bin/mailman start --force` option is fixed. (LP: #869317) * acquire_lock_1(): No need to unlink the tempfile * Start.process(): Don't print error message when the lock is in stale_lock or host_mismatch status and --force has been given. * control.rst: Refactor test code into test_control.py. * test_create.py: To more accurately mimic argparse, FakeParser.error() needs to `sys.exit(1)`. The `SystemExit` must also be caught in the appropriate tests. * logging.py: Locking is now down by the flufl.lock package, so apply the `mailman.lock` configuration to it. --- src/mailman/commands/tests/test_create.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/mailman/commands/tests/test_create.py') diff --git a/src/mailman/commands/tests/test_create.py b/src/mailman/commands/tests/test_create.py index c2176a106..76a8e0e00 100644 --- a/src/mailman/commands/tests/test_create.py +++ b/src/mailman/commands/tests/test_create.py @@ -25,6 +25,7 @@ __all__ = [ ] +import sys import unittest from mailman.app.lifecycle import create_list @@ -48,6 +49,7 @@ class FakeParser: def error(self, message): self.message = message + sys.exit(1) @@ -65,14 +67,20 @@ class TestCreate(unittest.TestCase): # Cannot create a mailing list if it already exists. create_list('test@example.com') self.args.listname = ['test@example.com'] - self.command.process(self.args) + try: + self.command.process(self.args) + except SystemExit: + pass self.assertEqual(self.command.parser.message, 'List already exists: test@example.com') def test_invalid_posting_address(self): # Cannot create a mailing list with an invalid posting address. self.args.listname = ['foo'] - self.command.process(self.args) + try: + self.command.process(self.args) + except SystemExit: + pass self.assertEqual(self.command.parser.message, 'Illegal list name: foo') @@ -81,7 +89,10 @@ class TestCreate(unittest.TestCase): self.args.listname = ['test@example.com'] self.args.domain = True self.args.owners = ['main=True'] - self.command.process(self.args) + try: + self.command.process(self.args) + except SystemExit: + pass self.assertEqual(self.command.parser.message, 'Illegal owner addresses: main=True') -- cgit v1.2.3-70-g09d2