Add tests for new command

This commit is contained in:
Matthias
2021-10-30 17:05:12 +02:00
parent 72ecb45d86
commit 20904f1ca4
4 changed files with 34 additions and 17 deletions

View File

@@ -10,7 +10,8 @@ from arrow import Arrow
from freqtrade.configuration import TimeRange
from freqtrade.constants import DATETIME_PRINT_FORMAT, LAST_BT_RESULT_FN
from freqtrade.data import history
from freqtrade.data.btanalysis import get_latest_backtest_filename, load_backtest_data, load_backtest_stats
from freqtrade.data.btanalysis import (get_latest_backtest_filename, load_backtest_data,
load_backtest_stats)
from freqtrade.edge import PairInfo
from freqtrade.enums import SellType
from freqtrade.optimize.optimize_reports import (_get_resample_from_period, generate_backtest_stats,
@@ -19,9 +20,9 @@ from freqtrade.optimize.optimize_reports import (_get_resample_from_period, gene
generate_periodic_breakdown_stats,
generate_sell_reason_stats,
generate_strategy_comparison,
generate_trading_stats, show_filtered_pairlist, store_backtest_stats,
text_table_bt_results, text_table_sell_reason,
text_table_strategy)
generate_trading_stats, show_sorted_pairlist,
store_backtest_stats, text_table_bt_results,
text_table_sell_reason, text_table_strategy)
from freqtrade.resolvers.strategy_resolver import StrategyResolver
from tests.data.test_history import _backup_file, _clean_test_file
@@ -409,12 +410,12 @@ def test__get_resample_from_period():
_get_resample_from_period('noooo')
def test_show_filtered_pairlist(testdatadir, default_conf, capsys):
def test_show_sorted_pairlist(testdatadir, default_conf, capsys):
filename = testdatadir / "backtest-result_new.json"
bt_data = load_backtest_stats(filename)
default_conf['backtest_show_pair_list'] = True
show_filtered_pairlist(default_conf, bt_data)
show_sorted_pairlist(default_conf, bt_data)
out, err = capsys.readouterr()
assert 'Pairs for Strategy StrategyTestV2: \n[' in out