diff options
| author | Barry Warsaw | 2014-11-30 21:51:03 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2014-11-30 21:51:03 -0500 |
| commit | 44e43727be13e3554342c2b5b75b7dc42abdb18c (patch) | |
| tree | a0b97771f5d0856709ac8ab48c1e8f9eeecef352 /src/mailman/testing | |
| parent | 065060e56ac2445b6749b60480e9c42573854c5e (diff) | |
| download | mailman-44e43727be13e3554342c2b5b75b7dc42abdb18c.tar.gz mailman-44e43727be13e3554342c2b5b75b7dc42abdb18c.tar.zst mailman-44e43727be13e3554342c2b5b75b7dc42abdb18c.zip | |
Checkpointing.
By using `six` I think I have most of the imports squared away. There's
probably still uses of `unicode` built-ins that need fixing.
The idea is to first get the test suite running (which it doesn't yet), and
then to fix tests.
There's a bug in lazr.config which requires us to patch it for now.
Diffstat (limited to 'src/mailman/testing')
| -rw-r--r-- | src/mailman/testing/helpers.py | 11 | ||||
| -rw-r--r-- | src/mailman/testing/layers.py | 5 | ||||
| -rw-r--r-- | src/mailman/testing/mta.py | 3 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index b0fe14a0d..1de0e98cf 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -59,8 +59,8 @@ from contextlib import contextmanager from email import message_from_string from httplib2 import Http from lazr.config import as_timedelta -from urllib import urlencode -from urllib2 import HTTPError +from six.moves.urllib_error import HTTPError +from six.moves.urllib_parse import urlencode from zope import event from zope.component import getUtility @@ -342,7 +342,7 @@ def call_api(url, data=None, method=None, username=None, password=None): if len(content) == 0: return None, response # XXX Workaround http://bugs.python.org/issue10038 - content = unicode(content) + content = content.decode('utf-8') return json.loads(content), response @@ -506,9 +506,8 @@ def specialized_message_from_string(unicode_text): """ # This mimic what Switchboard.dequeue() does when parsing a message from # text into a Message instance. - text = unicode_text.encode('ascii') - original_size = len(text) - message = message_from_string(text, Message) + original_size = len(unicode_text) + message = message_from_string(unicode_text, Message) message.original_size = original_size return message diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py index 74ad99dc8..8ec6c307f 100644 --- a/src/mailman/testing/layers.py +++ b/src/mailman/testing/layers.py @@ -46,7 +46,7 @@ import datetime import tempfile from lazr.config import as_boolean -from pkg_resources import resource_string +from pkg_resources import resource_string as resource_bytes from textwrap import dedent from zope.component import getUtility @@ -132,7 +132,8 @@ class ConfigLayer(MockAndMonkeyLayer): configuration: {1} """.format(cls.var_dir, postfix_cfg)) # Read the testing config and push it. - test_config += resource_string('mailman.testing', 'testing.cfg') + more = resource_bytes('mailman.testing', 'testing.cfg') + test_config += more.decode('utf-8') config.create_paths = True config.push('test config', test_config) # Initialize everything else. diff --git a/src/mailman/testing/mta.py b/src/mailman/testing/mta.py index 875647485..234540e98 100644 --- a/src/mailman/testing/mta.py +++ b/src/mailman/testing/mta.py @@ -27,10 +27,9 @@ __all__ = [ import logging -from Queue import Empty, Queue - from lazr.smtptest.controller import QueueController from lazr.smtptest.server import Channel, QueueServer +from six.moves.queue import Empty, Queue from zope.interface import implementer from mailman.interfaces.mta import IMailTransportAgentLifecycle |
