Skip to content

Commit

Permalink
add get team configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
erlanggakrisnamukti committed Jun 6, 2018
1 parent 6deb213 commit 81a6800
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions locust/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ClientConfiguration:
"""

config_data = None
path = None

def read_json(self):
"""
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions locust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 81a6800

Please sign in to comment.