add tests for brokers.toml file
parent
a12b008a15
commit
41ee931bc6
|
@ -427,7 +427,7 @@ def load_accounts(
|
||||||
|
|
||||||
) -> bidict[str, str | None]:
|
) -> bidict[str, str | None]:
|
||||||
|
|
||||||
conf, path = load()
|
conf, path = load(touch_if_dne=True)
|
||||||
accounts = bidict()
|
accounts = bidict()
|
||||||
for provider_name, section in conf.items():
|
for provider_name, section in conf.items():
|
||||||
accounts_section = section.get('accounts')
|
accounts_section = section.get('accounts')
|
||||||
|
|
|
@ -174,13 +174,14 @@ def tmpconfdir(
|
||||||
)
|
)
|
||||||
assert path.is_file(), 'WTH.. `brokers.toml` not created!?'
|
assert path.is_file(), 'WTH.. `brokers.toml` not created!?'
|
||||||
|
|
||||||
return tmpconfdir
|
yield tmpconfdir
|
||||||
|
|
||||||
# NOTE: the `tmp_dir` fixture will wipe any files older then 3 test
|
# NOTE: the `tmp_dir` fixture will wipe any files older then 3 test
|
||||||
# sessions by default:
|
# sessions by default:
|
||||||
# https://docs.pytest.org/en/6.2.x/tmpdir.html#the-default-base-temporary-directory
|
# https://docs.pytest.org/en/6.2.x/tmpdir.html#the-default-base-temporary-directory
|
||||||
# BUT, if we wanted to always wipe conf dir and all contained files,
|
# BUT, if we wanted to always wipe conf dir and all contained files,
|
||||||
# rmtree(str(tmp_path))
|
from shutil import rmtree
|
||||||
|
rmtree(str(tmp_path))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from piker import config
|
||||||
|
|
||||||
|
|
||||||
|
def test_root_conf_networking_section(
|
||||||
|
|
||||||
|
):
|
||||||
|
# load account names from ``brokers.toml``
|
||||||
|
accounts_def = config.load_accounts(
|
||||||
|
providers=['binans'],
|
||||||
|
)
|
||||||
|
# import pdbp; pdbp.set_trace()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue