Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix team configuration function #88

Merged
merged 2 commits into from
Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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):
Expand Down