summaryrefslogtreecommitdiff
path: root/src/mailman/testing/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/testing/helpers.py')
-rw-r--r--src/mailman/testing/helpers.py24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index 054dd4ff7..99f4b8961 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -249,8 +249,8 @@ def get_lmtp_client(quiet=False):
if not quiet:
print(response)
return lmtp
- except socket.error as error:
- if error[0] == errno.ECONNREFUSED:
+ except IOError as error:
+ if error.errno == errno.ECONNREFUSED:
time.sleep(0.1)
else:
raise
@@ -284,8 +284,8 @@ def wait_for_webservice():
try:
socket.socket().connect((config.webservice.hostname,
int(config.webservice.port)))
- except socket.error as error:
- if error[0] == errno.ECONNREFUSED:
+ except IOError as error:
+ if error.errno == errno.ECONNREFUSED:
time.sleep(0.1)
else:
raise
@@ -515,19 +515,3 @@ class LogFileMark:
with open(self._filename) as fp:
fp.seek(self._filepos)
return fp.readline()
-
-
-
-# In Python 2.6, body_line_iterator() uses a cStringIO.StringIO() which cannot
-# handle unicode. In Python 2.7 this works fine. I hate version checks but
-# this is the easiest way to handle it. OTOH, we could just use the manual
-# way for all Python versions instead.
-import sys
-if sys.hexversion >= 0x2070000:
- from email.iterators import body_line_iterator
-else:
- def body_line_iterator(msg, decode=False):
- payload = msg.get_payload(decode=decode)
- bytes_payload = payload.encode('utf-8')
- for line in bytes_payload.splitlines():
- yield line