diff --git a/locust/configuration.py b/locust/configuration.py index 4ab288dbd8..432a2c2c50 100644 --- a/locust/configuration.py +++ b/locust/configuration.py @@ -13,6 +13,7 @@ class ClientConfiguration: """ config_data = None + path = None def read_json(self): """ @@ -28,6 +29,20 @@ def read_json(self): self.config_data = json.load({}) return self.config_data + def get_team_config(self, path): + """ + Get config from team json + """ + try: + print(self.path) + 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) + self.config_data = json.load({}) + return self.config_data + + def update_json_config(self, json_added, json_path, options, list_column, config_text): """ Write JSON file configuration 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): """