fix tests: use testdatadir

This commit is contained in:
Joe Schr
2024-02-26 10:56:56 +01:00
parent c4a024e627
commit b15e47ded4

View File

@@ -17,39 +17,39 @@ def read_csv(filename, converter_columns: list = ['side', 'type']):
parse_dates=True, converters={col: str.strip for col in converter_columns}) parse_dates=True, converters={col: str.strip for col in converter_columns})
@pytest.fixture(scope="module") @pytest.fixture
def populate_dataframe_with_trades_dataframe(): def populate_dataframe_with_trades_dataframe(testdatadir):
return pd.read_feather('tests/testdata/populate_dataframe_with_trades_DF.feather') return pd.read_feather(testdatadir / 'populate_dataframe_with_trades_DF.feather')
@pytest.fixture(scope="module") @pytest.fixture
def populate_dataframe_with_trades_trades(): def populate_dataframe_with_trades_trades(testdatadir):
return pd.read_feather('tests/testdata/populate_dataframe_with_trades_TRADES.feather') return pd.read_feather(testdatadir / 'populate_dataframe_with_trades_TRADES.feather')
@pytest.fixture(scope="module") @pytest.fixture
def candles(): def candles(testdatadir):
return pd.read_json('tests/testdata/candles.json').copy() return pd.read_json(testdatadir / 'candles.json').copy()
@pytest.fixture(scope="module") @pytest.fixture
def public_trades_list(): def public_trades_list(testdatadir):
return read_csv('tests/testdata/public_trades_list.csv').copy() return read_csv(testdatadir / 'public_trades_list.csv').copy()
@pytest.fixture(scope="module") @pytest.fixture
def public_trades_list_simple(): def public_trades_list_simple(testdatadir):
return read_csv('tests/testdata/public_trades_list_simple_example.csv').copy() return read_csv(testdatadir / 'public_trades_list_simple_example.csv').copy()
@pytest.fixture(scope="module") @pytest.fixture
def public_trades_list_simple_results(): def public_trades_list_simple_results(testdatadir):
return read_csv('tests/testdata/public_trades_list_simple_results.csv').copy() return read_csv(testdatadir / 'public_trades_list_simple_results.csv').copy()
@pytest.fixture(scope="module") @pytest.fixture
def public_trades_list_simple_bidask(): def public_trades_list_simple_bidask(testdatadir):
return read_csv('tests/testdata/public_trades_list_simple_bidask.csv').copy() return read_csv(testdatadir / 'public_trades_list_simple_bidask.csv').copy()
def test_public_trades_columns_before_change( def test_public_trades_columns_before_change(