Improve shutdown behavior

closes #7882
This commit is contained in:
Matthias
2022-12-12 20:01:54 +01:00
parent b328a18a97
commit abc3badfb5
2 changed files with 20 additions and 1 deletions

View File

@@ -88,6 +88,18 @@ def test_bot_cleanup(mocker, default_conf_usdt, caplog) -> None:
assert coo_mock.call_count == 1
def test_bot_cleanup_db_errors(mocker, default_conf_usdt, caplog) -> None:
mocker.patch('freqtrade.freqtradebot.Trade.commit',
side_effect=OperationalException())
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.check_for_open_trades',
side_effect=OperationalException())
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
freqtrade.emc = MagicMock()
freqtrade.emc.shutdown = MagicMock()
freqtrade.cleanup()
assert freqtrade.emc.shutdown.call_count == 1
@pytest.mark.parametrize('runmode', [
RunMode.DRY_RUN,
RunMode.LIVE