diff --git a/piker/clearing/_client.py b/piker/clearing/_client.py index 08b0f4c8..0a40b548 100644 --- a/piker/clearing/_client.py +++ b/piker/clearing/_client.py @@ -235,7 +235,8 @@ async def open_ems( not getattr(mod, 'trades_dialogue', None) or mode == 'paper' ): - mode = 'paper' + mode = 'paper' + from ._ems import _emsd_main async with ( # connect to emsd @@ -254,6 +255,7 @@ async def open_ems( dialogs, ) ), + # open 2-way trade command stream ctx.open_stream() as trades_stream, ): @@ -263,7 +265,8 @@ async def open_ems( relay_order_cmds_from_sync_code, fqsn, trades_stream - ) + ) + yield ( book, trades_stream, diff --git a/piker/config.py b/piker/config.py index f7b1e588..abcbb652 100644 --- a/piker/config.py +++ b/piker/config.py @@ -76,7 +76,7 @@ def get_app_dir(app_name, roaming=True, force_posix=False): # TODO: This is a hacky way to a) determine we're testing # and b) creating a test dir. We should aim to set a variable # within the tractor runtimes and store testing config data - # outside of the users filesystem + # outside of the users filesystem if "pytest" in sys.modules: app_name = os.path.join(app_name, TEST_CONFIG_DIR_PATH) diff --git a/tests/test_paper.py b/tests/test_paper.py index 0d208ce0..f6183497 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -126,6 +126,7 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager, delete_testing_dir): except (NameError, AttributeError): pass # Do nothing, message isn't a position + await trio.sleep(1) # Assert entries are made in both ledger and PPS if assert_entries or assert_pps or assert_zeroed_pps: