Add hacky cleanup solution for _testng data
parent
66c568c7bc
commit
51ce71c969
|
@ -33,7 +33,6 @@ from .log import get_logger
|
||||||
|
|
||||||
log = get_logger('broker-config')
|
log = get_logger('broker-config')
|
||||||
|
|
||||||
|
|
||||||
# taken from ``click`` since apparently they have some
|
# taken from ``click`` since apparently they have some
|
||||||
# super weirdness with sigint and sudo..no clue
|
# super weirdness with sigint and sudo..no clue
|
||||||
def get_app_dir(app_name, roaming=True, force_posix=False):
|
def get_app_dir(app_name, roaming=True, force_posix=False):
|
||||||
|
@ -74,6 +73,10 @@ def get_app_dir(app_name, roaming=True, force_posix=False):
|
||||||
def _posixify(name):
|
def _posixify(name):
|
||||||
return "-".join(name.split()).lower()
|
return "-".join(name.split()).lower()
|
||||||
|
|
||||||
|
# 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
|
||||||
if "pytest" in sys.modules:
|
if "pytest" in sys.modules:
|
||||||
app_name += '/_testing'
|
app_name += '/_testing'
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ import trio
|
||||||
import pytest
|
import pytest
|
||||||
import tractor
|
import tractor
|
||||||
import math
|
import math
|
||||||
|
import os
|
||||||
|
from shutil import rmtree
|
||||||
|
from piker.config import get_app_dir
|
||||||
from piker.log import get_logger
|
from piker.log import get_logger
|
||||||
from piker.clearing._messages import (
|
from piker.clearing._messages import (
|
||||||
Order
|
Order
|
||||||
|
@ -11,30 +14,34 @@ from typing import (
|
||||||
AsyncContextManager,
|
AsyncContextManager,
|
||||||
Literal,
|
Literal,
|
||||||
)
|
)
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from piker.pp import (
|
from piker.pp import (
|
||||||
open_trade_ledger,
|
open_trade_ledger,
|
||||||
open_pps,
|
open_pps,
|
||||||
)
|
)
|
||||||
|
|
||||||
from piker.clearing import (
|
from piker.clearing import (
|
||||||
open_ems,
|
open_ems,
|
||||||
)
|
)
|
||||||
|
|
||||||
from piker.clearing._client import (
|
from piker.clearing._client import (
|
||||||
OrderBook,
|
OrderBook,
|
||||||
)
|
)
|
||||||
|
|
||||||
from piker.clearing._messages import (
|
from piker.clearing._messages import (
|
||||||
BrokerdPosition
|
BrokerdPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import BaseExceptionGroup
|
||||||
|
|
||||||
log = get_logger(__name__)
|
log = get_logger(__name__)
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def paper_cleanup():
|
||||||
|
yield
|
||||||
|
app_dir = get_app_dir('piker')
|
||||||
|
rmtree(app_dir)
|
||||||
|
assert not os.path.isfile(app_dir)
|
||||||
|
|
||||||
def test_paper_trade(
|
def test_paper_trade(
|
||||||
open_test_pikerd: AsyncContextManager
|
open_test_pikerd: AsyncContextManager,
|
||||||
|
paper_cleanup: None
|
||||||
):
|
):
|
||||||
|
|
||||||
test_exec_mode='live'
|
test_exec_mode='live'
|
||||||
|
|
Loading…
Reference in New Issue