Allow passing a config path for broker testing in CI

kivy_mainline_and_py3.8
Tyler Goodlet 2019-02-04 00:17:11 -05:00
parent 5339f754a1
commit 026b015627
1 changed files with 5 additions and 4 deletions

View File

@ -12,13 +12,14 @@ _config_dir = click.get_app_dir('piker')
_broker_conf_path = path.join(_config_dir, 'brokers.ini') _broker_conf_path = path.join(_config_dir, 'brokers.ini')
def load() -> (configparser.ConfigParser, str): def load(path: str = None) -> (configparser.ConfigParser, str):
"""Load broker config. """Load broker config.
""" """
path = path or _broker_conf_path
config = configparser.ConfigParser() config = configparser.ConfigParser()
read = config.read(_broker_conf_path) read = config.read(path)
log.debug(f"Read config file {_broker_conf_path}") log.debug(f"Read config file {path}")
return config, _broker_conf_path return config, path
def write(config: configparser.ConfigParser) -> None: def write(config: configparser.ConfigParser) -> None: