~barry/mailman/lp1423756

« back to all changes in this revision

Viewing changes to src/mailman/testing/layers.py

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# XXX 2012-03-23 BAW: Layers really really suck.  For example, the
21
21
# test_owners_get_email() test requires that both the SMTPLayer and LMTPLayer
22
22
# be set up, but there's apparently no way to do that and make zope.testing
23
 
# happy.  This causes no tests failures, but it does cause errors at the end
24
 
# of the full test run.  For now, I'll ignore that, but I do want to
25
 
# eventually get rid of the zope.test* dependencies and use something like
26
 
# testresources or some such.
27
 
 
28
 
from __future__ import absolute_import, print_function, unicode_literals
29
 
 
30
 
__metaclass__ = type
 
23
# happy.  This causes no test failures, but it does cause errors at the end of
 
24
# the full test run.  For now, I'll ignore that, but I do want to eventually
 
25
# get rid of the layers and use something like testresources or some such.
 
26
 
31
27
__all__ = [
32
28
    'ConfigLayer',
33
29
    'LMTPLayer',
46
42
import tempfile
47
43
 
48
44
from lazr.config import as_boolean
49
 
from pkg_resources import resource_string
50
 
from textwrap import dedent
51
 
from zope.component import getUtility
52
 
 
53
45
from mailman.config import config
54
46
from mailman.core import initialize
55
47
from mailman.core.initialize import INHIBIT_CONFIG_FILE
60
52
    TestableMaster, get_lmtp_client, reset_the_world, wait_for_webservice)
61
53
from mailman.testing.mta import ConnectionCountingController
62
54
from mailman.utilities.string import expand
 
55
from pkg_resources import resource_string as resource_bytes
 
56
from textwrap import dedent
 
57
from zope.component import getUtility
63
58
 
64
59
 
65
60
TEST_TIMEOUT = datetime.timedelta(seconds=5)
132
127
        configuration: {1}
133
128
        """.format(cls.var_dir, postfix_cfg))
134
129
        # Read the testing config and push it.
135
 
        test_config += resource_string('mailman.testing', 'testing.cfg')
 
130
        more = resource_bytes('mailman.testing', 'testing.cfg')
 
131
        test_config += more.decode('utf-8')
136
132
        config.create_paths = True
137
133
        config.push('test config', test_config)
138
134
        # Initialize everything else.