Compare commits

...

6 Commits

Author SHA1 Message Date
Guillermo Rodriguez 757b209f88
Merge pull request #531 from di1ara/brokers-toml-fix
add tests for brokers.toml file
2023-07-20 15:11:09 -03:00
di1ara 9c470846a6 added the error name 2023-07-20 13:45:50 -04:00
di1ara 5fd0e5020f changed the function name and added a doc string explaining 2023-07-20 13:38:33 -04:00
di1ara 390faeef46 deleted the comment and white spaces 2023-07-19 15:09:32 -04:00
di1ara 41ee931bc6 add tests for brokers.toml file 2023-07-17 20:02:52 -04:00
ebisu4 a12b008a15
Merge pull request #525 from pikers/msgspec_struct_updates
`msgspec` struct derivative updates
2023-06-27 20:00:09 +02:00
3 changed files with 18 additions and 2 deletions

View File

@ -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')

View File

@ -174,12 +174,13 @@ 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,
# from shutil import rmtree
# rmtree(str(tmp_path)) # rmtree(str(tmp_path))

View File

@ -0,0 +1,15 @@
'''
testing the creation of brokers.toml if it doesn't exist,
FileNotFoundError was found when trying to run piker chart on windows.
'''
from pathlib import Path
from piker import config
def test_brokers_created_from_template_on_load_accounts():
# load account names from ``brokers.toml``
accounts_def = config.load_accounts(
providers=['binance'],
)