diff options
| author | bwarsaw | 2006-07-08 18:04:28 +0000 |
|---|---|---|
| committer | bwarsaw | 2006-07-08 18:04:28 +0000 |
| commit | c638bce69ed31001eff7c580d0a37bb807211e2b (patch) | |
| tree | 9b206ff1d25552f3b39de542e6978e4f2c037fd0 /Mailman/testing/emailbase.py | |
| parent | c6bd2024ebcb3982bb07c3fed1bb13d7ded332bd (diff) | |
| download | mailman-c638bce69ed31001eff7c580d0a37bb807211e2b.tar.gz mailman-c638bce69ed31001eff7c580d0a37bb807211e2b.tar.zst mailman-c638bce69ed31001eff7c580d0a37bb807211e2b.zip | |
Diffstat (limited to 'Mailman/testing/emailbase.py')
| -rw-r--r-- | Mailman/testing/emailbase.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Mailman/testing/emailbase.py b/Mailman/testing/emailbase.py index fa0512e91..48cb163e2 100644 --- a/Mailman/testing/emailbase.py +++ b/Mailman/testing/emailbase.py @@ -18,6 +18,8 @@ """Base class for tests that email things.""" import os +import time +import errno import smtpd import socket import asyncore @@ -26,7 +28,7 @@ import subprocess from Mailman.configuration import config from Mailman.testing.base import TestBase -TESTPORT = 10825 +TESTPORT = 10825 @@ -53,7 +55,7 @@ class EmailBase(TestBase): def _configure(self, fp): TestBase._configure(self, fp) print >> fp, 'SMTPPORT =', TESTPORT - config.SMTPPORT + config.SMTPPORT = TESTPORT def setUp(self): TestBase.setUp(self) @@ -70,6 +72,19 @@ class EmailBase(TestBase): def tearDown(self): os.system('bin/mailmanctl -C %s -q stop' % self._config) self._server.close() + # Wait a while until the server actually goes away + while True: + try: + s = socket.socket() + s.connect(('localhost', TESTPORT)) + s.close() + time.sleep(3) + except socket.error, e: + # IWBNI e had an errno attribute + if e[0] == errno.ECONNREFUSED: + break + else: + raise TestBase.tearDown(self) os.remove(self._config) |
