மனோஜ்குமார் பழனிச்சாமி 2022-05-04 04:53:23 +05:30
parent 2705096ce6
commit 5cd5074166
3 changed files with 9 additions and 0 deletions

View File

@ -144,6 +144,7 @@ class Backtesting:
self.init_backtest() self.init_backtest()
def __del__(self): def __del__(self):
logger.info('Inside Backtesting.__del__()')
self.cleanup() self.cleanup()
@staticmethod @staticmethod
@ -151,6 +152,7 @@ class Backtesting:
LoggingMixin.show_output = True LoggingMixin.show_output = True
PairLocks.use_db = True PairLocks.use_db = True
Trade.use_db = True Trade.use_db = True
logger.info('Cleaned Backtest')
def init_backtest_detail(self): def init_backtest_detail(self):
# Load detail timeframe if specified # Load detail timeframe if specified

View File

@ -172,6 +172,7 @@ def api_delete_backtest(ws_mode=Depends(is_webserver_mode)):
"status_msg": "Backtest running", "status_msg": "Backtest running",
} }
if ApiServer._bt: if ApiServer._bt:
ApiServer._bt.cleanup()
del ApiServer._bt del ApiServer._bt
ApiServer._bt = None ApiServer._bt = None
del ApiServer._bt_data del ApiServer._bt_data

View File

@ -33,6 +33,12 @@ from tests.conftest_trades_usdt import (mock_trade_usdt_1, mock_trade_usdt_2, mo
logging.getLogger('').setLevel(logging.INFO) logging.getLogger('').setLevel(logging.INFO)
@pytest.fixture(autouse=True)
def run_around_tests():
yield
assert Trade.use_db
# Do not mask numpy errors as warnings that no one read, raise the exсeption # Do not mask numpy errors as warnings that no one read, raise the exсeption
np.seterr(all='raise') np.seterr(all='raise')