mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Change log_has to get caplog instead of caplog.record_tuples in more
tests
This commit is contained in:
parent
0221607318
commit
d53f63023a
|
@ -311,7 +311,7 @@ def test_edge_process_no_data(mocker, edge_conf, caplog):
|
|||
|
||||
assert not edge.calculate()
|
||||
assert len(edge._cached_pairs) == 0
|
||||
assert log_has("No data found. Edge is stopped ...", caplog.record_tuples)
|
||||
assert log_has("No data found. Edge is stopped ...", caplog)
|
||||
assert edge._last_updated == 0
|
||||
|
||||
|
||||
|
@ -326,7 +326,7 @@ def test_edge_process_no_trades(mocker, edge_conf, caplog):
|
|||
|
||||
assert not edge.calculate()
|
||||
assert len(edge._cached_pairs) == 0
|
||||
assert log_has("No trades found.", caplog.record_tuples)
|
||||
assert log_has("No trades found.", caplog)
|
||||
|
||||
|
||||
def test_edge_init_error(mocker, edge_conf,):
|
||||
|
|
|
@ -181,21 +181,18 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
|
|||
assert 'exchange' in config
|
||||
assert 'pair_whitelist' in config['exchange']
|
||||
assert 'datadir' in config
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog.record_tuples)
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog)
|
||||
|
||||
assert 'live' not in config
|
||||
assert not log_has('Parameter -l/--live detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter -l/--live detected ...', caplog)
|
||||
|
||||
assert 'position_stacking' not in config
|
||||
assert not log_has('Parameter --enable-position-stacking detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter --enable-position-stacking detected ...', caplog)
|
||||
|
||||
assert 'refresh_pairs' not in config
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
|
||||
assert 'timerange' not in config
|
||||
assert 'export' not in config
|
||||
|
@ -235,43 +232,31 @@ def test_setup_bt_configuration_with_arguments(mocker, default_conf, caplog) ->
|
|||
assert 'datadir' in config
|
||||
assert config['runmode'] == RunMode.BACKTEST
|
||||
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert log_has('Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
||||
caplog.record_tuples)
|
||||
caplog)
|
||||
|
||||
assert 'live' in config
|
||||
assert log_has('Parameter -l/--live detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter -l/--live detected ...', caplog)
|
||||
|
||||
assert 'position_stacking' in config
|
||||
assert log_has('Parameter --enable-position-stacking detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter --enable-position-stacking detected ...', caplog)
|
||||
|
||||
assert 'use_max_market_positions' in config
|
||||
assert log_has('Parameter --disable-max-market-positions detected ...', caplog.record_tuples)
|
||||
assert log_has('max_open_trades set to unlimited ...', caplog.record_tuples)
|
||||
assert log_has('Parameter --disable-max-market-positions detected ...', caplog)
|
||||
assert log_has('max_open_trades set to unlimited ...', caplog)
|
||||
|
||||
assert 'refresh_pairs' in config
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
|
||||
assert 'timerange' in config
|
||||
assert log_has(
|
||||
'Parameter --timerange detected: {} ...'.format(config['timerange']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Parameter --timerange detected: {} ...'.format(config['timerange']), caplog)
|
||||
|
||||
assert 'export' in config
|
||||
assert log_has(
|
||||
'Parameter --export detected: {} ...'.format(config['export']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Parameter --export detected: {} ...'.format(config['export']), caplog)
|
||||
assert 'exportfilename' in config
|
||||
assert log_has(
|
||||
'Storing backtest results to {} ...'.format(config['exportfilename']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Storing backtest results to {} ...'.format(config['exportfilename']), caplog)
|
||||
|
||||
|
||||
def test_setup_configuration_unlimited_stake_amount(mocker, default_conf, caplog) -> None:
|
||||
|
@ -303,10 +288,7 @@ def test_start(mocker, fee, default_conf, caplog) -> None:
|
|||
]
|
||||
args = get_args(args)
|
||||
start_backtesting(args)
|
||||
assert log_has(
|
||||
'Starting freqtrade in Backtesting mode',
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Starting freqtrade in Backtesting mode', caplog)
|
||||
assert start_mock.call_count == 1
|
||||
|
||||
|
||||
|
@ -360,7 +342,7 @@ def test_backtesting_init_no_ticker_interval(mocker, default_conf, caplog) -> No
|
|||
with pytest.raises(OperationalException):
|
||||
Backtesting(default_conf)
|
||||
log_has("Ticker-interval needs to be set in either configuration "
|
||||
"or as cli argument `--ticker-interval 5m`", caplog.record_tuples)
|
||||
"or as cli argument `--ticker-interval 5m`", caplog)
|
||||
|
||||
|
||||
def test_tickerdata_to_dataframe_bt(default_conf, mocker) -> None:
|
||||
|
@ -511,7 +493,7 @@ def test_backtesting_start(default_conf, mocker, caplog) -> None:
|
|||
'up to 2017-11-14T22:59:00+00:00 (0 days)..'
|
||||
]
|
||||
for line in exists:
|
||||
assert log_has(line, caplog.record_tuples)
|
||||
assert log_has(line, caplog)
|
||||
|
||||
|
||||
def test_backtesting_start_no_data(default_conf, mocker, caplog) -> None:
|
||||
|
@ -539,7 +521,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog) -> None:
|
|||
backtesting.start()
|
||||
# check the logs, that will contain the backtest result
|
||||
|
||||
assert log_has('No data found. Terminating.', caplog.record_tuples)
|
||||
assert log_has('No data found. Terminating.', caplog)
|
||||
|
||||
|
||||
def test_backtest(default_conf, fee, mocker) -> None:
|
||||
|
@ -876,7 +858,7 @@ def test_backtest_start_live(default_conf, mocker, caplog):
|
|||
]
|
||||
|
||||
for line in exists:
|
||||
assert log_has(line, caplog.record_tuples)
|
||||
assert log_has(line, caplog)
|
||||
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:DEPRECATED")
|
||||
|
@ -936,4 +918,4 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog):
|
|||
]
|
||||
|
||||
for line in exists:
|
||||
assert log_has(line, caplog.record_tuples)
|
||||
assert log_has(line, caplog)
|
||||
|
|
|
@ -29,15 +29,12 @@ def test_setup_configuration_without_arguments(mocker, default_conf, caplog) ->
|
|||
assert 'exchange' in config
|
||||
assert 'pair_whitelist' in config['exchange']
|
||||
assert 'datadir' in config
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog.record_tuples)
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog)
|
||||
|
||||
assert 'refresh_pairs' not in config
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
|
||||
assert 'timerange' not in config
|
||||
assert 'stoploss_range' not in config
|
||||
|
@ -69,21 +66,15 @@ def test_setup_edge_configuration_with_arguments(mocker, edge_conf, caplog) -> N
|
|||
assert 'pair_whitelist' in config['exchange']
|
||||
assert 'datadir' in config
|
||||
assert config['runmode'] == RunMode.EDGE
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert log_has('Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
||||
caplog.record_tuples)
|
||||
caplog)
|
||||
|
||||
assert 'refresh_pairs' in config
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
assert 'timerange' in config
|
||||
assert log_has(
|
||||
'Parameter --timerange detected: {} ...'.format(config['timerange']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Parameter --timerange detected: {} ...'.format(config['timerange']), caplog)
|
||||
|
||||
|
||||
def test_start(mocker, fee, edge_conf, caplog) -> None:
|
||||
|
@ -100,10 +91,7 @@ def test_start(mocker, fee, edge_conf, caplog) -> None:
|
|||
]
|
||||
args = get_args(args)
|
||||
start_edge(args)
|
||||
assert log_has(
|
||||
'Starting freqtrade in Edge mode',
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Starting freqtrade in Edge mode', caplog)
|
||||
assert start_mock.call_count == 1
|
||||
|
||||
|
||||
|
|
|
@ -79,21 +79,18 @@ def test_setup_hyperopt_configuration_without_arguments(mocker, default_conf, ca
|
|||
assert 'exchange' in config
|
||||
assert 'pair_whitelist' in config['exchange']
|
||||
assert 'datadir' in config
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog.record_tuples)
|
||||
assert not log_has_re('Parameter -i/--ticker-interval detected .*', caplog)
|
||||
|
||||
assert 'live' not in config
|
||||
assert not log_has('Parameter -l/--live detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter -l/--live detected ...', caplog)
|
||||
|
||||
assert 'position_stacking' not in config
|
||||
assert not log_has('Parameter --enable-position-stacking detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter --enable-position-stacking detected ...', caplog)
|
||||
|
||||
assert 'refresh_pairs' not in config
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert not log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
|
||||
assert 'timerange' not in config
|
||||
assert 'runmode' in config
|
||||
|
@ -130,41 +127,32 @@ def test_setup_hyperopt_configuration_with_arguments(mocker, default_conf, caplo
|
|||
assert 'datadir' in config
|
||||
assert config['runmode'] == RunMode.HYPEROPT
|
||||
|
||||
assert log_has(
|
||||
'Using data directory: {} ...'.format(config['datadir']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Using data directory: {} ...'.format(config['datadir']), caplog)
|
||||
assert 'ticker_interval' in config
|
||||
assert log_has('Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
||||
caplog.record_tuples)
|
||||
caplog)
|
||||
|
||||
assert 'position_stacking' in config
|
||||
assert log_has('Parameter --enable-position-stacking detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter --enable-position-stacking detected ...', caplog)
|
||||
|
||||
assert 'use_max_market_positions' in config
|
||||
assert log_has('Parameter --disable-max-market-positions detected ...', caplog.record_tuples)
|
||||
assert log_has('max_open_trades set to unlimited ...', caplog.record_tuples)
|
||||
assert log_has('Parameter --disable-max-market-positions detected ...', caplog)
|
||||
assert log_has('max_open_trades set to unlimited ...', caplog)
|
||||
|
||||
assert 'refresh_pairs' in config
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter -r/--refresh-pairs-cached detected ...', caplog)
|
||||
|
||||
assert 'timerange' in config
|
||||
assert log_has(
|
||||
'Parameter --timerange detected: {} ...'.format(config['timerange']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Parameter --timerange detected: {} ...'.format(config['timerange']), caplog)
|
||||
|
||||
assert 'epochs' in config
|
||||
assert log_has('Parameter --epochs detected ... Will run Hyperopt with for 1000 epochs ...',
|
||||
caplog.record_tuples)
|
||||
caplog)
|
||||
|
||||
assert 'spaces' in config
|
||||
assert log_has(
|
||||
'Parameter -s/--spaces detected: {}'.format(config['spaces']),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Parameter -s/--spaces detected: {}'.format(config['spaces']), caplog)
|
||||
assert 'print_all' in config
|
||||
assert log_has('Parameter --print-all detected ...', caplog.record_tuples)
|
||||
assert log_has('Parameter --print-all detected ...', caplog)
|
||||
|
||||
|
||||
def test_hyperoptresolver(mocker, default_conf, caplog) -> None:
|
||||
|
@ -181,9 +169,9 @@ def test_hyperoptresolver(mocker, default_conf, caplog) -> None:
|
|||
assert not hasattr(x, 'populate_buy_trend')
|
||||
assert not hasattr(x, 'populate_sell_trend')
|
||||
assert log_has("Custom Hyperopt does not provide populate_sell_trend. "
|
||||
"Using populate_sell_trend from DefaultStrategy.", caplog.record_tuples)
|
||||
"Using populate_sell_trend from DefaultStrategy.", caplog)
|
||||
assert log_has("Custom Hyperopt does not provide populate_buy_trend. "
|
||||
"Using populate_buy_trend from DefaultStrategy.", caplog.record_tuples)
|
||||
"Using populate_buy_trend from DefaultStrategy.", caplog)
|
||||
assert hasattr(x, "ticker_interval")
|
||||
|
||||
|
||||
|
@ -229,10 +217,7 @@ def test_start(mocker, default_conf, caplog) -> None:
|
|||
import pprint
|
||||
pprint.pprint(caplog.record_tuples)
|
||||
|
||||
assert log_has(
|
||||
'Starting freqtrade in Hyperopt mode',
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Starting freqtrade in Hyperopt mode', caplog)
|
||||
assert start_mock.call_count == 1
|
||||
|
||||
|
||||
|
@ -257,7 +242,7 @@ def test_start_no_data(mocker, default_conf, caplog) -> None:
|
|||
import pprint
|
||||
pprint.pprint(caplog.record_tuples)
|
||||
|
||||
assert log_has('No data found. Terminating.', caplog.record_tuples)
|
||||
assert log_has('No data found. Terminating.', caplog)
|
||||
|
||||
|
||||
def test_start_failure(mocker, default_conf, caplog) -> None:
|
||||
|
@ -275,10 +260,7 @@ def test_start_failure(mocker, default_conf, caplog) -> None:
|
|||
args = get_args(args)
|
||||
with pytest.raises(DependencyException):
|
||||
start_hyperopt(args)
|
||||
assert log_has(
|
||||
"Please don't use --strategy for hyperopt.",
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has("Please don't use --strategy for hyperopt.", caplog)
|
||||
|
||||
|
||||
def test_start_filelock(mocker, default_conf, caplog) -> None:
|
||||
|
@ -294,10 +276,7 @@ def test_start_filelock(mocker, default_conf, caplog) -> None:
|
|||
]
|
||||
args = get_args(args)
|
||||
start_hyperopt(args)
|
||||
assert log_has(
|
||||
"Another running instance of freqtrade Hyperopt detected.",
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has("Another running instance of freqtrade Hyperopt detected.", caplog)
|
||||
|
||||
|
||||
def test_loss_calculation_prefer_correct_trade_count(default_conf, hyperopt_results) -> None:
|
||||
|
@ -401,10 +380,7 @@ def test_save_trials_saves_trials(mocker, hyperopt, caplog) -> None:
|
|||
hyperopt.save_trials()
|
||||
|
||||
trials_file = os.path.join('freqtrade', 'tests', 'optimize', 'ut_trials.pickle')
|
||||
assert log_has(
|
||||
'Saving 1 evaluations to \'{}\''.format(trials_file),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Saving 1 evaluations to \'{}\''.format(trials_file), caplog)
|
||||
mock_dump.assert_called_once()
|
||||
|
||||
|
||||
|
@ -413,10 +389,7 @@ def test_read_trials_returns_trials_file(mocker, hyperopt, caplog) -> None:
|
|||
mock_load = mocker.patch('freqtrade.optimize.hyperopt.load', return_value=trials)
|
||||
hyperopt_trial = hyperopt.read_trials()
|
||||
trials_file = os.path.join('freqtrade', 'tests', 'optimize', 'ut_trials.pickle')
|
||||
assert log_has(
|
||||
'Reading Trials from \'{}\''.format(trials_file),
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Reading Trials from \'{}\''.format(trials_file), caplog)
|
||||
assert hyperopt_trial == trials
|
||||
mock_load.assert_called_once()
|
||||
|
||||
|
@ -626,7 +599,7 @@ def test_clean_hyperopt(mocker, default_conf, caplog):
|
|||
Hyperopt(default_conf)
|
||||
|
||||
assert unlinkmock.call_count == 2
|
||||
assert log_has(f"Removing `{TICKERDATA_PICKLE}`.", caplog.record_tuples)
|
||||
assert log_has(f"Removing `{TICKERDATA_PICKLE}`.", caplog)
|
||||
|
||||
|
||||
def test_continue_hyperopt(mocker, default_conf, caplog):
|
||||
|
@ -643,4 +616,4 @@ def test_continue_hyperopt(mocker, default_conf, caplog):
|
|||
Hyperopt(default_conf)
|
||||
|
||||
assert unlinkmock.call_count == 0
|
||||
assert log_has(f"Continuing on previous hyperopt results.", caplog.record_tuples)
|
||||
assert log_has(f"Continuing on previous hyperopt results.", caplog)
|
||||
|
|
|
@ -49,12 +49,12 @@ def test_returns_latest_sell_signal(mocker, default_conf, ticker_history):
|
|||
def test_get_signal_empty(default_conf, mocker, caplog):
|
||||
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['ticker_interval'],
|
||||
DataFrame())
|
||||
assert log_has('Empty ticker history for pair foo', caplog.record_tuples)
|
||||
assert log_has('Empty ticker history for pair foo', caplog)
|
||||
caplog.clear()
|
||||
|
||||
assert (False, False) == _STRATEGY.get_signal('bar', default_conf['ticker_interval'],
|
||||
[])
|
||||
assert log_has('Empty ticker history for pair bar', caplog.record_tuples)
|
||||
assert log_has('Empty ticker history for pair bar', caplog)
|
||||
|
||||
|
||||
def test_get_signal_exception_valueerror(default_conf, mocker, caplog, ticker_history):
|
||||
|
@ -65,7 +65,7 @@ def test_get_signal_exception_valueerror(default_conf, mocker, caplog, ticker_hi
|
|||
)
|
||||
assert (False, False) == _STRATEGY.get_signal('foo', default_conf['ticker_interval'],
|
||||
ticker_history)
|
||||
assert log_has('Unable to analyze ticker for pair foo: xyz', caplog.record_tuples)
|
||||
assert log_has('Unable to analyze ticker for pair foo: xyz', caplog)
|
||||
|
||||
|
||||
def test_get_signal_empty_dataframe(default_conf, mocker, caplog, ticker_history):
|
||||
|
@ -76,7 +76,7 @@ def test_get_signal_empty_dataframe(default_conf, mocker, caplog, ticker_history
|
|||
)
|
||||
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
|
||||
ticker_history)
|
||||
assert log_has('Empty dataframe for pair xyz', caplog.record_tuples)
|
||||
assert log_has('Empty dataframe for pair xyz', caplog)
|
||||
|
||||
|
||||
def test_get_signal_old_dataframe(default_conf, mocker, caplog, ticker_history):
|
||||
|
@ -91,10 +91,7 @@ def test_get_signal_old_dataframe(default_conf, mocker, caplog, ticker_history):
|
|||
)
|
||||
assert (False, False) == _STRATEGY.get_signal('xyz', default_conf['ticker_interval'],
|
||||
ticker_history)
|
||||
assert log_has(
|
||||
'Outdated history for pair xyz. Last tick is 16 minutes old',
|
||||
caplog.record_tuples
|
||||
)
|
||||
assert log_has('Outdated history for pair xyz. Last tick is 16 minutes old', caplog)
|
||||
|
||||
|
||||
def test_get_signal_handles_exceptions(mocker, default_conf):
|
||||
|
@ -237,9 +234,8 @@ def test_analyze_ticker_default(ticker_history, mocker, caplog) -> None:
|
|||
assert buy_mock.call_count == 1
|
||||
assert buy_mock.call_count == 1
|
||||
|
||||
assert log_has('TA Analysis Launched', caplog.record_tuples)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle',
|
||||
caplog.record_tuples)
|
||||
assert log_has('TA Analysis Launched', caplog)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle', caplog)
|
||||
caplog.clear()
|
||||
|
||||
strategy.analyze_ticker(ticker_history, {'pair': 'ETH/BTC'})
|
||||
|
@ -247,9 +243,8 @@ def test_analyze_ticker_default(ticker_history, mocker, caplog) -> None:
|
|||
assert ind_mock.call_count == 2
|
||||
assert buy_mock.call_count == 2
|
||||
assert buy_mock.call_count == 2
|
||||
assert log_has('TA Analysis Launched', caplog.record_tuples)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle',
|
||||
caplog.record_tuples)
|
||||
assert log_has('TA Analysis Launched', caplog)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle', caplog)
|
||||
|
||||
|
||||
def test__analyze_ticker_internal_skip_analyze(ticker_history, mocker, caplog) -> None:
|
||||
|
@ -275,9 +270,8 @@ def test__analyze_ticker_internal_skip_analyze(ticker_history, mocker, caplog) -
|
|||
assert ind_mock.call_count == 1
|
||||
assert buy_mock.call_count == 1
|
||||
assert buy_mock.call_count == 1
|
||||
assert log_has('TA Analysis Launched', caplog.record_tuples)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle',
|
||||
caplog.record_tuples)
|
||||
assert log_has('TA Analysis Launched', caplog)
|
||||
assert not log_has('Skipping TA Analysis for already analyzed candle', caplog)
|
||||
caplog.clear()
|
||||
|
||||
ret = strategy._analyze_ticker_internal(ticker_history, {'pair': 'ETH/BTC'})
|
||||
|
@ -290,6 +284,5 @@ def test__analyze_ticker_internal_skip_analyze(ticker_history, mocker, caplog) -
|
|||
assert 'sell' in ret.columns
|
||||
assert ret['buy'].sum() == 0
|
||||
assert ret['sell'].sum() == 0
|
||||
assert not log_has('TA Analysis Launched', caplog.record_tuples)
|
||||
assert log_has('Skipping TA Analysis for already analyzed candle',
|
||||
caplog.record_tuples)
|
||||
assert not log_has('TA Analysis Launched', caplog)
|
||||
assert log_has('Skipping TA Analysis for already analyzed candle', caplog)
|
||||
|
|
|
@ -76,8 +76,7 @@ def test_load_strategy_base64(result, caplog):
|
|||
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
||||
# Make sure strategy was loaded from base64 (using temp directory)!!
|
||||
assert log_has_re(r"Using resolved strategy TestStrategy from '"
|
||||
+ tempfile.gettempdir() + r"/.*/TestStrategy\.py'\.\.\.",
|
||||
caplog.record_tuples)
|
||||
+ tempfile.gettempdir() + r"/.*/TestStrategy\.py'\.\.\.", caplog)
|
||||
|
||||
|
||||
def test_load_strategy_invalid_directory(result, caplog):
|
||||
|
@ -85,7 +84,7 @@ def test_load_strategy_invalid_directory(result, caplog):
|
|||
extra_dir = Path.cwd() / 'some/path'
|
||||
resolver._load_strategy('TestStrategy', config={}, extra_dir=extra_dir)
|
||||
|
||||
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog.record_tuples)
|
||||
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog)
|
||||
|
||||
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
||||
|
||||
|
@ -105,7 +104,7 @@ def test_load_staticmethod_importerror(mocker, caplog):
|
|||
match=r"Impossible to load Strategy 'DefaultStrategy'. "
|
||||
r"This class does not exist or contains Python code errors."):
|
||||
StrategyResolver()
|
||||
assert log_has_re(r".*Error: can't pickle staticmethod objects", caplog.record_tuples)
|
||||
assert log_has_re(r".*Error: can't pickle staticmethod objects", caplog)
|
||||
|
||||
|
||||
def test_strategy(result):
|
||||
|
|
Loading…
Reference in New Issue
Block a user