diff options
Diffstat (limited to 'mailman/testing/layers.py')
| -rw-r--r-- | mailman/testing/layers.py | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/mailman/testing/layers.py b/mailman/testing/layers.py index 97d6ade23..bda18289c 100644 --- a/mailman/testing/layers.py +++ b/mailman/testing/layers.py @@ -27,7 +27,9 @@ __all__ = [ import os import shutil import tempfile -import textwrap + +from pkg_resources import resource_string +from textwrap import dedent from mailman.config import config from mailman.core.initialize import initialize @@ -47,45 +49,19 @@ class ConfigLayer: def setUp(cls): initialize() assert cls.var_dir is None, 'Layer already set up' - test_config = [] # Calculate a temporary VAR_DIR directory so that run-time artifacts # of the tests won't tread on the installation's data. This also # makes it easier to clean up after the tests are done, and insures # isolation of test suite runs. cls.var_dir = tempfile.mkdtemp() - # lazr.config says it doesn't care about indentation, but we've - # actually got mixed indentation above because of the for-loop. It's - # just safer to dedent the whole string now. - test_config.append(textwrap.dedent(""" + # Create a section with the var directory. + test_config = dedent(""" [mailman] var_dir: %s - """ % cls.var_dir)) - # Push a high port for our test SMTP server. - test_config.append(textwrap.dedent(""" - [mta] - smtp_port: 9025 - """)) - # Set the qrunners to exit after one error. - for qrunner in config.qrunner_shortcuts: - test_config.append(textwrap.dedent(""" - [qrunner.%s] - max_restarts: 1 - """ % qrunner)) - # Add stuff for the archiver and a sample domain. - test_config.append(textwrap.dedent(""" - [archiver.mail_archive] - base_url: http://go.mail-archive.dev/ - recipient: archive@mail-archive.dev - - [domain.example_dot_com] - email_host: example.com - base_url: http://www.example.com - contact_address: postmaster@example.com - """)) - config_string = NL.join(test_config) - import pdb; pdb.set_trace() - config.push('test config', config_string) - config._config.getByCategory('domain') + """ % cls.var_dir) + # Read the testing config, but don't push it yet. + test_config += resource_string('mailman.testing', 'testing.cfg') + config.push('test config', test_config) @classmethod def tearDown(cls): |
