Update test_convert_ohlcv_format to test as before
it did test conversion of multiple files, and that should be kept this way.
This commit is contained in:
parent
5a3b907132
commit
cff950d783
@ -292,23 +292,29 @@ def test_convert_trades_format(default_conf, testdatadir, tmpdir):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('file_base,candletype', [
|
@pytest.mark.parametrize('file_base,candletype', [
|
||||||
('XRP_ETH-5m', CandleType.SPOT),
|
(['XRP_ETH-5m', 'XRP_ETH-1m'], CandleType.SPOT),
|
||||||
('XRP_ETH-1m', CandleType.SPOT),
|
(['UNITTEST_USDT-1h-mark', 'XRP_USDT-1h-mark'], CandleType.MARK),
|
||||||
('XRP_USDT-1h-mark', CandleType.MARK),
|
(['XRP_USDT-1h-futures'], CandleType.FUTURES),
|
||||||
('XRP_USDT-1h-futures', CandleType.FUTURES),
|
|
||||||
])
|
])
|
||||||
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, candletype):
|
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, candletype):
|
||||||
tmpdir1 = Path(tmpdir)
|
tmpdir1 = Path(tmpdir)
|
||||||
prependix = '' if candletype == CandleType.SPOT else 'futures/'
|
prependix = '' if candletype == CandleType.SPOT else 'futures/'
|
||||||
file_orig = testdatadir / f"{prependix}{file_base}.json"
|
files_orig = []
|
||||||
file_temp = tmpdir1 / f"{prependix}{file_base}.json"
|
files_temp = []
|
||||||
file_new = tmpdir1 / f"{prependix}{file_base}.json.gz"
|
files_new = []
|
||||||
IDataHandler.create_dir_if_needed(file_temp)
|
for file in file_base:
|
||||||
|
file_orig = testdatadir / f"{prependix}{file}.json"
|
||||||
|
file_temp = tmpdir1 / f"{prependix}{file}.json"
|
||||||
|
file_new = tmpdir1 / f"{prependix}{file}.json.gz"
|
||||||
|
IDataHandler.create_dir_if_needed(file_temp)
|
||||||
|
copyfile(file_orig, file_temp)
|
||||||
|
|
||||||
copyfile(file_orig, file_temp)
|
files_orig.append(file_orig)
|
||||||
|
files_temp.append(file_temp)
|
||||||
|
files_new.append(file_new)
|
||||||
|
|
||||||
default_conf['datadir'] = tmpdir1
|
default_conf['datadir'] = tmpdir1
|
||||||
default_conf['pairs'] = ['XRP_ETH', 'XRP_USDT']
|
default_conf['pairs'] = ['XRP_ETH', 'XRP_USDT', 'UNITTEST_USDT']
|
||||||
default_conf['timeframes'] = ['1m', '5m', '1h']
|
default_conf['timeframes'] = ['1m', '5m', '1h']
|
||||||
|
|
||||||
assert not file_new.exists()
|
assert not file_new.exists()
|
||||||
@ -320,12 +326,12 @@ def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, cand
|
|||||||
erase=False,
|
erase=False,
|
||||||
candle_type=candletype
|
candle_type=candletype
|
||||||
)
|
)
|
||||||
|
for file in (files_temp + files_new):
|
||||||
assert file_new.exists()
|
assert file.exists()
|
||||||
assert file_temp.exists()
|
|
||||||
|
|
||||||
# Remove original files
|
# Remove original files
|
||||||
file_temp.unlink()
|
for file in (files_temp):
|
||||||
|
file.unlink()
|
||||||
# Convert back
|
# Convert back
|
||||||
convert_ohlcv_format(
|
convert_ohlcv_format(
|
||||||
default_conf,
|
default_conf,
|
||||||
@ -334,6 +340,7 @@ def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, cand
|
|||||||
erase=True,
|
erase=True,
|
||||||
candle_type=candletype
|
candle_type=candletype
|
||||||
)
|
)
|
||||||
|
for file in (files_temp):
|
||||||
assert file_temp.exists()
|
assert file.exists()
|
||||||
assert not file_new.exists()
|
for file in (files_new):
|
||||||
|
assert not file.exists()
|
||||||
|
Loading…
Reference in New Issue
Block a user