From cf0b85aa510d4b7b4ffe5191aec05fb520248430 Mon Sep 17 00:00:00 2001 From: algorandpa Date: Wed, 15 Feb 2023 19:12:26 -0500 Subject: [PATCH] Add back cleanup fixture --- piker/config.py | 4 ++-- tests/test_paper.py | 8 ++++---- tests/test_services.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/piker/config.py b/piker/config.py index e4c2705f..1e69b218 100644 --- a/piker/config.py +++ b/piker/config.py @@ -30,7 +30,7 @@ from bidict import bidict import toml from .log import get_logger - +from tests.test_services import get_test_app_dir log = get_logger('broker-config') # taken from ``click`` since apparently they have some @@ -78,7 +78,7 @@ 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: - app_name += '/_testing' + return get_test_app_dir() # if WIN: if platform.system() == 'Windows': diff --git a/tests/test_paper.py b/tests/test_paper.py index 8efd2281..91fa0d07 100644 --- a/tests/test_paper.py +++ b/tests/test_paper.py @@ -32,13 +32,13 @@ from exceptiongroup import BaseExceptionGroup log = get_logger(__name__) -@pytest.fixture +@pytest.fixture(scope="session") def paper_cleanup(): yield app_dir = get_app_dir('piker') - # if os.path.isfile(app_dir): - # rmtree(app_dir) - # assert not os.path.isfile(app_dir) + if os.path.isfile(app_dir): + rmtree(app_dir) + assert not os.path.isfile(app_dir) def test_paper_trade( open_test_pikerd: AsyncContextManager, diff --git a/tests/test_services.py b/tests/test_services.py index 11f0db7c..e44a21f4 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -177,4 +177,4 @@ def test_ensure_ems_in_paper_actors( trio.run(main) cancel_msg: str = '_emsd_main()` was remotely cancelled by its caller' - assert cancel_msg in exc_info.value.args[0] + assert cancel_msg in exc_info.value.args[0]