From 4c2e776e01362348d8006ce477bd89fdbf3bee51 Mon Sep 17 00:00:00 2001 From: jaredgoldman Date: Fri, 24 Feb 2023 18:05:17 -0500 Subject: [PATCH] Ensure to cleanup by passing fixture in paper_test signature --- piker/config.py | 1 - tests/test_paper.py | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/piker/config.py b/piker/config.py index b1b2eedc..f7b1e588 100644 --- a/piker/config.py +++ b/piker/config.py @@ -78,7 +78,6 @@ def get_app_dir(app_name, roaming=True, force_posix=False): # within the tractor runtimes and store testing config data # outside of the users filesystem if "pytest" in sys.modules: - log.info("TESTING") app_name = os.path.join(app_name, TEST_CONFIG_DIR_PATH) # if WIN: diff --git a/tests/test_paper.py b/tests/test_paper.py index 8f05503d..66e85893 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -38,7 +38,7 @@ from piker.clearing._messages import BrokerdPosition log = get_logger(__name__) -@pytest.fixture(scope="module") +@pytest.fixture(scope="session") def delete_testing_dir(): """This fixture removes the temp directory used for storing all config/ledger/pp data @@ -56,7 +56,7 @@ def get_fqsn(broker, symbol): return (fqsn, symbol, broker) -def test_paper_trade(open_test_pikerd: AsyncContextManager): +def test_paper_trade(open_test_pikerd: AsyncContextManager, delete_testing_dir): oid = "" test_exec_mode = "live" test_account = "paper" @@ -71,7 +71,6 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager): ] async def _async_main( - open_pikerd: AsyncContextManager, action: Literal["buy", "sell"] | None = None, price: int = 30000, assert_entries: bool = False, @@ -87,7 +86,7 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager): # Set up piker and EMS async with ( - open_pikerd() as (_, _, _, services), + open_test_pikerd() as (_, _, _, services), open_ems(fqsn, mode="paper") as ( book, trades_stream, @@ -189,7 +188,6 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager): BaseExceptionGroup, partial( _async_main, - open_pikerd=open_test_pikerd, action="buy", ), # _assert_entries @@ -197,13 +195,13 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager): _run_test_and_check( BaseExceptionGroup, - partial(_async_main, open_pikerd=open_test_pikerd), + partial(_async_main), _assert_pps, ) _run_test_and_check( BaseExceptionGroup, - partial(_async_main, open_pikerd=open_test_pikerd, action="sell", price=1), + partial(_async_main, action="sell", price=1), _assert_no_pps, )