diff --git a/locust/configuration.py b/locust/configuration.py index d34f5da620..0eef6d1396 100644 --- a/locust/configuration.py +++ b/locust/configuration.py @@ -12,7 +12,8 @@ class ClientConfiguration: This class is a handler for data configuration with JSON data structure. """ - config_data = None + def __init__(self): + self.config_data = None def read_json(self, path=None): """ @@ -22,6 +23,11 @@ def read_json(self, path=None): if self.config_data is None: if path is None: path = CONFIG_PATH + else : + if path.startswith('./') : + path = path[1:] + elif not path.startswith('/'): + path = '/%s' % (path) try: with open((os.environ['PYTHONPATH'].split(os.pathsep))[-1] + path, "r") as data_file: self.config_data = json.load(data_file) diff --git a/locust/core.py b/locust/core.py index aade285d47..13cd9f489e 100644 --- a/locust/core.py +++ b/locust/core.py @@ -422,13 +422,13 @@ def configuration(self): Reference to configuration.py """ return self.config.read_json() - + def team_configuration(self, path): """ Reference to get_team_config func in configuration.py """ config = ClientConfiguration() - return config.get_team_config(path) + return config.read_json(path) @property def runners(self):