Make sure backtesting is cleaned up in tests
This commit is contained in:
parent
53452c8d64
commit
42df65d4ec
@ -128,7 +128,8 @@ class Backtesting:
|
||||
def __del__(self):
|
||||
self.cleanup()
|
||||
|
||||
def cleanup(self):
|
||||
@staticmethod
|
||||
def cleanup():
|
||||
LoggingMixin.show_output = True
|
||||
PairLocks.use_db = True
|
||||
Trade.use_db = True
|
||||
|
@ -52,6 +52,13 @@ def trim_dictlist(dict_list, num):
|
||||
return new
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def backtesting_cleanup() -> None:
|
||||
yield None
|
||||
|
||||
Backtesting.cleanup()
|
||||
|
||||
|
||||
def load_data_test(what, testdatadir):
|
||||
timerange = TimeRange.parse_timerange('1510694220-1510700340')
|
||||
data = history.load_pair_history(pair='UNITTEST/BTC', datadir=testdatadir,
|
||||
@ -553,8 +560,6 @@ def test_backtest__enter_trade(default_conf, fee, mocker) -> None:
|
||||
trade = backtesting._enter_trade(pair, row=row)
|
||||
assert trade is None
|
||||
|
||||
backtesting.cleanup()
|
||||
|
||||
|
||||
def test_backtest__get_sell_trade_entry(default_conf, fee, mocker) -> None:
|
||||
default_conf['use_sell_signal'] = False
|
||||
|
@ -1108,6 +1108,7 @@ def test_api_forcesell(botclient, mocker, ticker, fee, markets):
|
||||
data='{"tradeid": "1"}')
|
||||
assert_response(rc, 502)
|
||||
assert rc.json() == {"error": "Error querying /api/v1/forcesell: invalid argument"}
|
||||
Trade.query.session.rollback()
|
||||
|
||||
ftbot.enter_positions()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user