diff options
| author | Barry Warsaw | 2016-03-25 11:48:34 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-03-25 11:48:34 -0400 |
| commit | ca4259f4abd2802f87b86907c281a8b4cdb8150b (patch) | |
| tree | cfac73fb29bb3edcc2cd83e54b7c9cc61b74d84e /src/mailman/mta/tests | |
| parent | 7fd9e5ab09b0da347da0607b47d2d3838bd80f0c (diff) | |
| download | mailman-ca4259f4abd2802f87b86907c281a8b4cdb8150b.tar.gz mailman-ca4259f4abd2802f87b86907c281a8b4cdb8150b.tar.zst mailman-ca4259f4abd2802f87b86907c281a8b4cdb8150b.zip | |
Clean up the mta directory.
Diffstat (limited to 'src/mailman/mta/tests')
| -rw-r--r-- | src/mailman/mta/tests/test_aliases.py | 14 | ||||
| -rw-r--r-- | src/mailman/mta/tests/test_connection.py | 6 | ||||
| -rw-r--r-- | src/mailman/mta/tests/test_delivery.py | 14 |
3 files changed, 6 insertions, 28 deletions
diff --git a/src/mailman/mta/tests/test_aliases.py b/src/mailman/mta/tests/test_aliases.py index 4f62d7f49..1bc79df93 100644 --- a/src/mailman/mta/tests/test_aliases.py +++ b/src/mailman/mta/tests/test_aliases.py @@ -17,12 +17,6 @@ """Test the MTA file generating utility.""" -__all__ = [ - 'TestAliases', - 'TestPostfix', - ] - - import os import shutil import tempfile @@ -44,7 +38,6 @@ def _strip_header(contents): return NL.join(lines[7:]) - class TestAliases(unittest.TestCase): layer = ConfigLayer @@ -94,7 +87,7 @@ class TestAliases(unittest.TestCase): def __init__(self, list_name, mail_host): self.list_name = list_name self.mail_host = mail_host - self.posting_address = '{0}@{1}'.format(list_name, mail_host) + self.posting_address = '{}@{}'.format(list_name, mail_host) duck_list = Duck('sample', 'example.net') aliases = list(self.utility.aliases(duck_list)) self.assertEqual(aliases, [ @@ -129,7 +122,6 @@ class TestAliases(unittest.TestCase): ]) - class TestPostfix(unittest.TestCase): """Test the Postfix LMTP alias generator.""" @@ -137,15 +129,13 @@ class TestPostfix(unittest.TestCase): def setUp(self): self.tempdir = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, self.tempdir) self.utility = getUtility(IMailTransportAgentAliases) self.mlist = create_list('test@example.com') self.postfix = LMTP() # Let assertMultiLineEqual work without bounds. self.maxDiff = None - def tearDown(self): - shutil.rmtree(self.tempdir) - def test_aliases(self): # Test the format of the Postfix alias generator. self.postfix.regenerate(self.tempdir) diff --git a/src/mailman/mta/tests/test_connection.py b/src/mailman/mta/tests/test_connection.py index 3590808b7..3c4114634 100644 --- a/src/mailman/mta/tests/test_connection.py +++ b/src/mailman/mta/tests/test_connection.py @@ -17,11 +17,6 @@ """Test MTA connections.""" -__all__ = [ - 'TestConnection', - ] - - import unittest from mailman.config import config @@ -30,7 +25,6 @@ from mailman.testing.layers import SMTPLayer from smtplib import SMTPAuthenticationError - class TestConnection(unittest.TestCase): layer = SMTPLayer diff --git a/src/mailman/mta/tests/test_delivery.py b/src/mailman/mta/tests/test_delivery.py index a953f331f..fda74faad 100644 --- a/src/mailman/mta/tests/test_delivery.py +++ b/src/mailman/mta/tests/test_delivery.py @@ -17,11 +17,6 @@ """Test various aspects of email delivery.""" -__all__ = [ - 'TestIndividualDelivery', - ] - - import os import shutil import tempfile @@ -36,10 +31,10 @@ from mailman.testing.helpers import ( from mailman.testing.layers import ConfigLayer - # Global test capture. _deliveries = [] + # Derive this from the default individual delivery class. The point being # that we don't want to *actually* attempt delivery of the message to the MTA, # we just want to capture the messages and metadata dictionaries for @@ -51,7 +46,6 @@ class DeliverTester(Deliver): return [] - class TestIndividualDelivery(unittest.TestCase): """Test personalized delivery details.""" @@ -72,6 +66,7 @@ Subject: test """) # Set up a personalized footer for decoration. self._template_dir = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, self._template_dir) path = os.path.join(self._template_dir, 'site', 'en', 'member-footer.txt') os.makedirs(os.path.dirname(path)) @@ -87,15 +82,14 @@ options : $user_optionsurl [paths.testing] template_dir: {0} """.format(self._template_dir)) + self.addCleanup(config.pop, 'templates') self._mlist.footer_uri = 'mailman:///member-footer.txt' # Let assertMultiLineEqual work without bounds. self.maxDiff = None def tearDown(self): - # Free references. + # Free global references. del _deliveries[:] - shutil.rmtree(self._template_dir) - config.pop('templates') def test_member_key(self): # 'personalize' should end up in the metadata dictionary so that |
