From 944c1945fc796790eb9dc7f206e9509de849ac28 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Sun, 26 Feb 2023 16:11:28 -0500 Subject: [PATCH] Add backpressure setting back as it wasn't altering test behaviour --- piker/data/feed.py | 2 +- tests/test_paper.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/piker/data/feed.py b/piker/data/feed.py index b045ad41..906f4bb4 100644 --- a/piker/data/feed.py +++ b/piker/data/feed.py @@ -1467,7 +1467,7 @@ async def maybe_open_feed( 'tick_throttle': kwargs.get('tick_throttle'), # XXX: super critical to have bool defaults here XD - # 'backpressure': kwargs.get('backpressure', True), + 'backpressure': kwargs.get('backpressure', True), 'start_stream': kwargs.get('start_stream', True), }, key=fqsn, diff --git a/tests/test_paper.py b/tests/test_paper.py index 1a0fdd2f..cf84dd6a 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -41,25 +41,26 @@ async def _async_main( open_test_pikerd_and_ems: AsyncContextManager, action: Literal['buy', 'sell'] | None = None, price: int = 30000, + executions: int = 1, + size: float = 0.01, + # Assert options assert_entries: bool = False, assert_pps: bool = False, assert_zeroed_pps: bool = False, assert_msg: bool = False, - executions: int = 1, - size: float = 0.01, -) -> None: - '''Start piker, place a trade and assert data in pps stream, ledger and position table. Then restart piker and ensure - that pps from previous trade exists in the ems pps. - Finally close the position and ensure that the position in pps.toml is closed. + ) -> None: ''' + Start piker, place a trade and assert data in + pps stream, ledger and position table. + ''' + oid: str = '' last_msg = {} + async with open_test_pikerd_and_ems() as ( services, (book, trades_stream, pps, accounts, dialogs), ): - # Set up piker and EMS - # Send order to EMS if action: for x in range(executions): oid = str(uuid4()) @@ -80,6 +81,7 @@ async def _async_main( async for msg in trades_stream: last_msg = msg match msg: + # Wait for position message before moving on case {'name': 'position'}: break @@ -183,7 +185,6 @@ def test_sell(open_test_pikerd_and_ems: AsyncContextManager, delete_testing_dir) ) -# def test_multi_sell(open_test_pikerd_and_ems: AsyncContextManager, delete_testing_dir): # Make 5 market limit buy orders _run_test_and_check(