Use confdir if provided even when in CI
parent
3a439fc99d
commit
b99c5d2abe
|
@ -35,16 +35,31 @@ def test_config():
|
||||||
return dirpath
|
return dirpath
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session', autouse=True)
|
||||||
def travis():
|
def confdir(request, test_config):
|
||||||
|
"""If the `--confdir` flag is not passed use the
|
||||||
|
broker config file found in that dir.
|
||||||
|
"""
|
||||||
|
confdir = request.config.option.confdir
|
||||||
|
if confdir is not None:
|
||||||
|
config._override_config_dir(confdir)
|
||||||
|
|
||||||
|
# return config.load()[0]
|
||||||
|
return confdir
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='session', autouse=True)
|
||||||
|
def travis(confdir):
|
||||||
is_travis = os.environ.get('TRAVIS', False)
|
is_travis = os.environ.get('TRAVIS', False)
|
||||||
if is_travis:
|
if is_travis:
|
||||||
# this directory is cached, see .travis.yaml
|
# this directory is cached, see .travis.yaml
|
||||||
cache_dir = config.get_broker_conf_path()
|
cache_dir = confdir or config.get_broker_conf_path()
|
||||||
refresh_token = os.environ['QT_REFRESH_TOKEN']
|
refresh_token = os.environ['QT_REFRESH_TOKEN']
|
||||||
|
|
||||||
def write_with_token(token):
|
def write_with_token(token):
|
||||||
conf, path = config.load(cache_dir)
|
# XXX don't pass the dir path here since may be
|
||||||
|
# written behind the scenes in the `confdir fixture`
|
||||||
|
conf, path = config.load()
|
||||||
conf.setdefault('questrade', {}).update(
|
conf.setdefault('questrade', {}).update(
|
||||||
{'refresh_token': token,
|
{'refresh_token': token,
|
||||||
'is_practice': 'True'}
|
'is_practice': 'True'}
|
||||||
|
@ -76,18 +91,6 @@ def travis():
|
||||||
trio.run(ensure_config)
|
trio.run(ensure_config)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session', autouse=True)
|
|
||||||
def brokerconf(request, test_config, travis):
|
|
||||||
"""If the `--confdir` flag is not passed use the
|
|
||||||
broker config file found in that dir.
|
|
||||||
"""
|
|
||||||
confdir = request.config.option.confdir
|
|
||||||
if confdir is not None:
|
|
||||||
config._override_config_dir(confdir)
|
|
||||||
|
|
||||||
return config.load()[0]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def us_symbols():
|
def us_symbols():
|
||||||
return ['TSLA', 'AAPL', 'CGC', 'CRON']
|
return ['TSLA', 'AAPL', 'CGC', 'CRON']
|
||||||
|
|
Loading…
Reference in New Issue