Skip to content

Commit

Permalink
bug fix team configuration function (locustio#88)
Browse files Browse the repository at this point in the history
* change team_configuration function

* update configuration works
  • Loading branch information
erlanggakrisnamukti authored and pancaprima committed Aug 21, 2018
1 parent dc4768a commit 0d012a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion locust/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions locust/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,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):
Expand Down

0 comments on commit 0d012a1

Please sign in to comment.