Commit ce2818eb authored by Barry Warsaw's avatar Barry Warsaw

The test suite has to be able to inhibit the loading of any configuration

files.
parent 8de541b0
......@@ -32,6 +32,7 @@ __all__ = [
'initialize_1',
'initialize_2',
'initialize_3',
'INHIBIT_CONFIG_FILE',
]
......@@ -48,6 +49,11 @@ import mailman.core.logging
from mailman.interfaces.database import IDatabase
from mailman.utilities.modules import call_name
# The test infrastructure uses this to prevent the search and loading of any
# existing configuration file. Otherwise the existence of say a
# ~/.mailman.cfg file can break tests.
INHIBIT_CONFIG_FILE = object()
def search_for_configuration_file():
......@@ -109,6 +115,9 @@ def initialize_1(config_path=None, propagate_logs=None):
# configuration file is searched for in the file system.
if config_path is None:
config_path = search_for_configuration_file()
elif config_path is INHIBIT_CONFIG_FILE:
# For the test suite, force this back to not using a config file.
config_path = None
mailman.config.config.load(config_path)
# Create the queue and log directories if they don't already exist.
mailman.config.config.ensure_directories_exist()
......
......@@ -42,6 +42,7 @@ from zope.component import getUtility
from mailman.config import config
from mailman.core import initialize
from mailman.core.initialize import INHIBIT_CONFIG_FILE
from mailman.core.i18n import _
from mailman.core.logging import get_handler
from mailman.interfaces.domain import IDomainManager
......@@ -83,7 +84,7 @@ class ConfigLayer(MockAndMonkeyLayer):
@classmethod
def setUp(cls):
# Set up the basic configuration stuff.
initialize.initialize_1()
initialize.initialize_1(INHIBIT_CONFIG_FILE)
assert cls.var_dir is None, 'Layer already set up'
# Calculate a temporary VAR_DIR directory so that run-time artifacts
# of the tests won't tread on the installation's data. This also
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment