filename is not optional

While it can be set to ultimately a value of None, when a
config file is read in from stdin, it is not optional.

We kinda make use of it's ability to be set to None in our
tests but functionally and design wise, it is required.

If filename is not set, extends does not work.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-08-21 17:04:10 +01:00
parent c907f35e74
commit 1344533b24
3 changed files with 4 additions and 4 deletions

View File

@ -151,7 +151,7 @@ def load(config_details):
class ServiceLoader(object):
def __init__(self, working_dir, filename=None, already_seen=None):
def __init__(self, working_dir, filename, already_seen=None):
if working_dir is None:
raise Exception("No working_dir passed to ServiceLoader()")

View File

@ -31,7 +31,7 @@ class DockerClientTestCase(unittest.TestCase):
if 'command' not in kwargs:
kwargs['command'] = ["top"]
options = ServiceLoader(working_dir='.').make_service_dict(name, kwargs)
options = ServiceLoader(working_dir='.', filename=None).make_service_dict(name, kwargs)
labels = options.setdefault('labels', {})
labels['com.docker.compose.test-name'] = self.id()

View File

@ -11,11 +11,11 @@ from compose.config import config
from compose.config.errors import ConfigurationError
def make_service_dict(name, service_dict, working_dir):
def make_service_dict(name, service_dict, working_dir, filename=None):
"""
Test helper function to construct a ServiceLoader
"""
return config.ServiceLoader(working_dir=working_dir).make_service_dict(name, service_dict)
return config.ServiceLoader(working_dir=working_dir, filename=filename).make_service_dict(name, service_dict)
def service_sort(services):