Merge pull request #3394 from freqtrade/disable_dataframechecks

Allow changing severity of strategy-validations to log only.
This commit is contained in:
hroff-1902
2020-05-30 19:28:38 +03:00
committed by GitHub
6 changed files with 46 additions and 28 deletions

View File

@@ -130,7 +130,7 @@ def test_assert_df_raise(default_conf, mocker, caplog, ohlcv_history):
caplog)
def test_assert_df(default_conf, mocker, ohlcv_history):
def test_assert_df(default_conf, mocker, ohlcv_history, caplog):
# Ensure it's running when passed correctly
_STRATEGY.assert_df(ohlcv_history, len(ohlcv_history),
ohlcv_history.loc[1, 'close'], ohlcv_history.loc[1, 'date'])
@@ -148,6 +148,14 @@ def test_assert_df(default_conf, mocker, ohlcv_history):
_STRATEGY.assert_df(ohlcv_history, len(ohlcv_history),
ohlcv_history.loc[1, 'close'], ohlcv_history.loc[0, 'date'])
_STRATEGY.disable_dataframe_checks = True
caplog.clear()
_STRATEGY.assert_df(ohlcv_history, len(ohlcv_history),
ohlcv_history.loc[1, 'close'], ohlcv_history.loc[0, 'date'])
assert log_has_re(r"Dataframe returned from strategy.*last date\.", caplog)
# reset to avoid problems in other tests due to test leakage
_STRATEGY.disable_dataframe_checks = False
def test_get_signal_handles_exceptions(mocker, default_conf):
exchange = get_patched_exchange(mocker, default_conf)