set capturing level
This commit is contained in:
parent
8ba08af539
commit
45975c9677
@ -24,6 +24,7 @@ def maybe_init_api(conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_init(default_conf, mocker, caplog):
|
def test_init(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
maybe_init_api(default_conf, mocker)
|
maybe_init_api(default_conf, mocker)
|
||||||
assert ('freqtrade.exchange',
|
assert ('freqtrade.exchange',
|
||||||
logging.INFO,
|
logging.INFO,
|
||||||
@ -71,6 +72,7 @@ def test_validate_pairs_not_compatible(default_conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_validate_pairs_exception(default_conf, mocker, caplog):
|
def test_validate_pairs_exception(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
api_mock = MagicMock()
|
api_mock = MagicMock()
|
||||||
api_mock.get_markets = MagicMock(side_effect=RequestException())
|
api_mock.get_markets = MagicMock(side_effect=RequestException())
|
||||||
mocker.patch('freqtrade.exchange._API', api_mock)
|
mocker.patch('freqtrade.exchange._API', api_mock)
|
||||||
|
@ -168,6 +168,7 @@ def mocked_load_data(datadir, pairs=[], ticker_interval=0, refresh_pairs=False,
|
|||||||
|
|
||||||
|
|
||||||
def test_backtest_start(default_conf, mocker, caplog):
|
def test_backtest_start(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
default_conf['exchange']['pair_whitelist'] = ['BTC_UNITEST']
|
default_conf['exchange']['pair_whitelist'] = ['BTC_UNITEST']
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
mocker.patch('freqtrade.misc.load_config', new=lambda s: default_conf)
|
mocker.patch('freqtrade.misc.load_config', new=lambda s: default_conf)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# pragma pylint: disable=missing-docstring,W0212,C0103
|
# pragma pylint: disable=missing-docstring,W0212,C0103
|
||||||
|
import logging
|
||||||
|
|
||||||
from freqtrade.optimize.hyperopt import calculate_loss, TARGET_TRADES, EXPECTED_MAX_PROFIT, start, \
|
from freqtrade.optimize.hyperopt import calculate_loss, TARGET_TRADES, EXPECTED_MAX_PROFIT, start, \
|
||||||
log_results, save_trials, read_trials, generate_roi_table
|
log_results, save_trials, read_trials, generate_roi_table
|
||||||
|
|
||||||
@ -109,6 +111,7 @@ def test_no_log_if_loss_does_not_improve(mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_fmin_best_results(mocker, caplog):
|
def test_fmin_best_results(mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
fmin_result = {
|
fmin_result = {
|
||||||
"macd_below_zero": 0,
|
"macd_below_zero": 0,
|
||||||
"adx": 1,
|
"adx": 1,
|
||||||
@ -156,6 +159,7 @@ def test_fmin_best_results(mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_fmin_throw_value_error(mocker, caplog):
|
def test_fmin_throw_value_error(mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.hyperopt.MongoTrials', return_value=create_trials(mocker))
|
mocker.patch('freqtrade.optimize.hyperopt.MongoTrials', return_value=create_trials(mocker))
|
||||||
mocker.patch('freqtrade.optimize.tickerdata_to_dataframe')
|
mocker.patch('freqtrade.optimize.tickerdata_to_dataframe')
|
||||||
mocker.patch('freqtrade.optimize.load_data')
|
mocker.patch('freqtrade.optimize.load_data')
|
||||||
|
@ -46,6 +46,7 @@ def _clean_test_file(file: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_load_data_30min_ticker(default_conf, ticker_history, mocker, caplog):
|
def test_load_data_30min_ticker(default_conf, ticker_history, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ def test_load_data_30min_ticker(default_conf, ticker_history, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_load_data_5min_ticker(default_conf, ticker_history, mocker, caplog):
|
def test_load_data_5min_ticker(default_conf, ticker_history, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
@ -78,6 +80,7 @@ def test_load_data_5min_ticker(default_conf, ticker_history, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_load_data_1min_ticker(default_conf, ticker_history, mocker, caplog):
|
def test_load_data_1min_ticker(default_conf, ticker_history, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
@ -94,6 +97,7 @@ def test_load_data_1min_ticker(default_conf, ticker_history, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_load_data_with_new_pair_1min(default_conf, ticker_history, mocker, caplog):
|
def test_load_data_with_new_pair_1min(default_conf, ticker_history, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.get_ticker_history', return_value=ticker_history)
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
@ -154,6 +158,7 @@ def test_download_pairs(default_conf, ticker_history, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_download_pairs_exception(default_conf, ticker_history, mocker, caplog):
|
def test_download_pairs_exception(default_conf, ticker_history, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history)
|
mocker.patch('freqtrade.optimize.__init__.get_ticker_history', return_value=ticker_history)
|
||||||
mocker.patch('freqtrade.optimize.__init__.download_backtesting_testdata',
|
mocker.patch('freqtrade.optimize.__init__.download_backtesting_testdata',
|
||||||
side_effect=BaseException('File Error'))
|
side_effect=BaseException('File Error'))
|
||||||
|
@ -63,6 +63,7 @@ def test_strategy(result):
|
|||||||
|
|
||||||
|
|
||||||
def test_strategy_override_minimal_roi(caplog):
|
def test_strategy_override_minimal_roi(caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
config = {
|
config = {
|
||||||
'strategy': 'default_strategy',
|
'strategy': 'default_strategy',
|
||||||
'minimal_roi': {
|
'minimal_roi': {
|
||||||
@ -81,6 +82,7 @@ def test_strategy_override_minimal_roi(caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_strategy_override_stoploss(caplog):
|
def test_strategy_override_stoploss(caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
config = {
|
config = {
|
||||||
'strategy': 'default_strategy',
|
'strategy': 'default_strategy',
|
||||||
'stoploss': -0.5
|
'stoploss': -0.5
|
||||||
@ -97,6 +99,8 @@ def test_strategy_override_stoploss(caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_strategy_override_ticker_interval(caplog):
|
def test_strategy_override_ticker_interval(caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
'strategy': 'default_strategy',
|
'strategy': 'default_strategy',
|
||||||
'ticker_interval': 60
|
'ticker_interval': 60
|
||||||
|
@ -3,6 +3,7 @@ import datetime
|
|||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
|
import logging
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
import freqtrade.tests.conftest as tt # test tools
|
import freqtrade.tests.conftest as tt # test tools
|
||||||
@ -69,6 +70,7 @@ def test_returns_latest_sell_signal(mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_signal_empty(default_conf, mocker, caplog):
|
def test_get_signal_empty(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=None)
|
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=None)
|
||||||
assert (False, False) == get_signal('foo', int(default_conf['ticker_interval']))
|
assert (False, False) == get_signal('foo', int(default_conf['ticker_interval']))
|
||||||
assert tt.log_has('Empty ticker history for pair foo',
|
assert tt.log_has('Empty ticker history for pair foo',
|
||||||
@ -76,6 +78,7 @@ def test_get_signal_empty(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_signal_exception_valueerror(default_conf, mocker, caplog):
|
def test_get_signal_exception_valueerror(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
||||||
mocker.patch('freqtrade.analyze.analyze_ticker',
|
mocker.patch('freqtrade.analyze.analyze_ticker',
|
||||||
side_effect=ValueError('xyz'))
|
side_effect=ValueError('xyz'))
|
||||||
@ -85,6 +88,7 @@ def test_get_signal_exception_valueerror(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_signal_empty_dataframe(default_conf, mocker, caplog):
|
def test_get_signal_empty_dataframe(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
||||||
mocker.patch('freqtrade.analyze.analyze_ticker', return_value=DataFrame([]))
|
mocker.patch('freqtrade.analyze.analyze_ticker', return_value=DataFrame([]))
|
||||||
assert (False, False) == get_signal('xyz', int(default_conf['ticker_interval']))
|
assert (False, False) == get_signal('xyz', int(default_conf['ticker_interval']))
|
||||||
@ -93,6 +97,7 @@ def test_get_signal_empty_dataframe(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_get_signal_old_dataframe(default_conf, mocker, caplog):
|
def test_get_signal_old_dataframe(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
mocker.patch('freqtrade.analyze.get_ticker_history', return_value=1)
|
||||||
# FIX: The get_signal function has hardcoded 10, which we must inturn hardcode
|
# FIX: The get_signal function has hardcoded 10, which we must inturn hardcode
|
||||||
oldtime = arrow.utcnow() - datetime.timedelta(minutes=11)
|
oldtime = arrow.utcnow() - datetime.timedelta(minutes=11)
|
||||||
@ -112,7 +117,6 @@ def test_get_signal_handles_exceptions(mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_parse_ticker_dataframe(ticker_history, ticker_history_without_bv):
|
def test_parse_ticker_dataframe(ticker_history, ticker_history_without_bv):
|
||||||
|
|
||||||
columns = ['close', 'high', 'low', 'open', 'date', 'volume']
|
columns = ['close', 'high', 'low', 'open', 'date', 'volume']
|
||||||
|
|
||||||
# Test file with BV data
|
# Test file with BV data
|
||||||
|
@ -69,6 +69,7 @@ def test_process_maybe_execute_sell(default_conf, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_process_maybe_execute_buy_exception(default_conf, mocker, caplog):
|
def test_process_maybe_execute_buy_exception(default_conf, mocker, caplog):
|
||||||
|
caplog.set_level(logging.INFO)
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
mocker.patch('freqtrade.main.create_trade', MagicMock(side_effect=DependencyException))
|
mocker.patch('freqtrade.main.create_trade', MagicMock(side_effect=DependencyException))
|
||||||
main.process_maybe_execute_buy(int(default_conf['ticker_interval']))
|
main.process_maybe_execute_buy(int(default_conf['ticker_interval']))
|
||||||
@ -359,6 +360,7 @@ def test_handle_overlpapping_signals(default_conf, ticker, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_handle_trade_roi(default_conf, ticker, mocker, caplog):
|
def test_handle_trade_roi(default_conf, ticker, mocker, caplog):
|
||||||
|
caplog.set_level(logging.DEBUG)
|
||||||
default_conf.update({'experimental': {'use_sell_signal': True}})
|
default_conf.update({'experimental': {'use_sell_signal': True}})
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
@ -391,6 +393,7 @@ def test_handle_trade_roi(default_conf, ticker, mocker, caplog):
|
|||||||
|
|
||||||
|
|
||||||
def test_handle_trade_experimental(default_conf, ticker, mocker, caplog):
|
def test_handle_trade_experimental(default_conf, ticker, mocker, caplog):
|
||||||
|
caplog.set_level(logging.DEBUG)
|
||||||
default_conf.update({'experimental': {'use_sell_signal': True}})
|
default_conf.update({'experimental': {'use_sell_signal': True}})
|
||||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user