diff --git a/locust/configuration.py b/locust/configuration.py index 4ab288dbd8..d34f5da620 100644 --- a/locust/configuration.py +++ b/locust/configuration.py @@ -14,14 +14,16 @@ class ClientConfiguration: config_data = None - def read_json(self): + def read_json(self, path=None): """ Will get the data of configuration as JSON. It reads configuration file once. """ if self.config_data is None: + if path is None: + path = CONFIG_PATH try: - with open((os.environ['PYTHONPATH'].split(os.pathsep))[-1] + CONFIG_PATH, "r") as data_file: + with open((os.environ['PYTHONPATH'].split(os.pathsep))[-1] + path, "r") as data_file: self.config_data = json.load(data_file) except Exception as err: logger.info(err) diff --git a/locust/core.py b/locust/core.py index c5ae32049e..f69443fd81 100644 --- a/locust/core.py +++ b/locust/core.py @@ -371,6 +371,13 @@ def configuration(self): """ 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) + @property def runners(self): """