Tidy up ems tests as per some `ruff`in

master
Tyler Goodlet 2023-05-25 18:04:52 -04:00
parent 4a8e8a32f9
commit 06cc3ac92c
1 changed files with 10 additions and 15 deletions

View File

@ -50,16 +50,6 @@ from piker.accounting import (
log = get_logger(__name__) log = get_logger(__name__)
async def open_pikerd(
open_test_pikerd: AsyncContextManager,
) -> Services:
async with (
open_test_pikerd() as (_, _, _, services),
):
yield services
async def order_and_and_wait_for_ppmsg( async def order_and_and_wait_for_ppmsg(
client: OrderClient, client: OrderClient,
trades_stream: tractor.MsgStream, trades_stream: tractor.MsgStream,
@ -174,7 +164,7 @@ def test_ems_err_on_bad_broker(
async def load_bad_fqme(): async def load_bad_fqme():
try: try:
async with ( async with (
open_test_pikerd() as (_, _, _, services), open_test_pikerd() as (_, _, _, _),
open_ems( open_ems(
'doggycoin.doggy', 'doggycoin.doggy',
@ -268,7 +258,7 @@ async def submit_and_check(
trades_stream, # tractor.MsgStream trades_stream, # tractor.MsgStream
startup_pps, startup_pps,
accounts, accounts,
dialogs, _, # dialogs
) )
): ):
# no positions on startup # no positions on startup
@ -370,7 +360,7 @@ def test_multi_fill_positions(
nonlocal ppmsg, pos nonlocal ppmsg, pos
async with ( async with (
open_test_pikerd() as (_, _, _, services), open_test_pikerd() as (_, _, _, _),
): ):
ppmsg, pos = await submit_and_check( ppmsg, pos = await submit_and_check(
fills=fills, fills=fills,
@ -385,19 +375,24 @@ def test_multi_fill_positions(
# account (i.e. a user can expect to see paper pps persist across # account (i.e. a user can expect to see paper pps persist across
# runtime sessions. # runtime sessions.
async def just_check_pp(): async def just_check_pp():
nonlocal ppmsg
async with ( async with (
open_test_pikerd() as (_, _, _, services), open_test_pikerd() as (_, _, _, _),
): ):
await match_ppmsgs_on_ems_boot([ppmsg]) await match_ppmsgs_on_ems_boot([ppmsg])
run_and_tollerate_cancels(just_check_pp) run_and_tollerate_cancels(just_check_pp)
# TODO: still need to implement offline storage of darks/alerts/paper
# lives probably all the same way.. see
# https://github.com/pikers/piker/issues/463
def test_open_orders_reloaded( def test_open_orders_reloaded(
open_test_pikerd: AsyncContextManager, open_test_pikerd: AsyncContextManager,
loglevel: str, loglevel: str,
fills: tuple[dict], # fills: tuple[dict],
check_cross_session: bool = False, check_cross_session: bool = False,
): ):