summaryrefslogtreecommitdiff
path: root/mailman/testing/layers.py
diff options
context:
space:
mode:
authorBarry Warsaw2008-12-23 17:33:37 -0500
committerBarry Warsaw2008-12-23 17:33:37 -0500
commitd4de7996e6d4fb5db04dfed3b3fd12747622b164 (patch)
treeda5485447a128a0dd857a2a492168deec838362b /mailman/testing/layers.py
parentfd600d3952393dc9808fefb9be871f78cdbdff39 (diff)
downloadmailman-d4de7996e6d4fb5db04dfed3b3fd12747622b164.tar.gz
mailman-d4de7996e6d4fb5db04dfed3b3fd12747622b164.tar.zst
mailman-d4de7996e6d4fb5db04dfed3b3fd12747622b164.zip
Use my lazr.config megamerge branch for now, even though it's still under
development. Completely rework the way switchboards and queue runners are initialized, i.e. driven from the configuration file instead of hard coded. The various queue runner directories are no longer available thorugh the config object directly. Get them from config.switchboards. Provide minimal mailman.cfg and testing.cfg configuration files. Neuter styles for now until they can be consolidated with lazr.config.
Diffstat (limited to 'mailman/testing/layers.py')
-rw-r--r--mailman/testing/layers.py42
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):