Merge pull request #2244 from freqtrade/minor/cleanup

[minor] cleanup tests and fix excluded samplestrategy
This commit is contained in:
hroff-1902 2019-09-08 21:19:53 +03:00 committed by GitHub
commit 42d2ecba68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1 additions and 16 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ config*.json
*.sqlite *.sqlite
logfile.txt logfile.txt
user_data/* user_data/*
!user_data/strategy/sample_strategy.py
!user_data/notebooks !user_data/notebooks
user_data/notebooks/* user_data/notebooks/*
!user_data/notebooks/*example.ipynb !user_data/notebooks/*example.ipynb

View File

@ -155,8 +155,6 @@ def test_edge_results(edge_conf, mocker, caplog, data) -> None:
trades = edge._find_trades_for_stoploss_range(frame, 'TEST/BTC', [data.stop_loss]) trades = edge._find_trades_for_stoploss_range(frame, 'TEST/BTC', [data.stop_loss])
results = edge._fill_calculable_fields(DataFrame(trades)) if trades else DataFrame() results = edge._fill_calculable_fields(DataFrame(trades)) if trades else DataFrame()
print(results)
assert len(trades) == len(data.trades) assert len(trades) == len(data.trades)
if not results.empty: if not results.empty:

View File

@ -1035,7 +1035,6 @@ def test_get_historic_ohlcv(default_conf, mocker, caplog, exchange_name):
exchange._async_get_candle_history = Mock(wraps=mock_candle_hist) exchange._async_get_candle_history = Mock(wraps=mock_candle_hist)
# one_call calculation * 1.8 should do 2 calls # one_call calculation * 1.8 should do 2 calls
since = 5 * 60 * 500 * 1.8 since = 5 * 60 * 500 * 1.8
print(f"since = {since}")
ret = exchange.get_historic_ohlcv(pair, "5m", int((arrow.utcnow().timestamp - since) * 1000)) ret = exchange.get_historic_ohlcv(pair, "5m", int((arrow.utcnow().timestamp - since) * 1000))
assert exchange._async_get_candle_history.call_count == 2 assert exchange._async_get_candle_history.call_count == 2
@ -1340,7 +1339,6 @@ def test_get_order(default_conf, mocker, exchange_name):
order.myid = 123 order.myid = 123
exchange = get_patched_exchange(mocker, default_conf, id=exchange_name) exchange = get_patched_exchange(mocker, default_conf, id=exchange_name)
exchange._dry_run_open_orders['X'] = order exchange._dry_run_open_orders['X'] = order
print(exchange.get_order('X', 'TKN/BTC'))
assert exchange.get_order('X', 'TKN/BTC').myid == 123 assert exchange.get_order('X', 'TKN/BTC').myid == 123
with pytest.raises(InvalidOrderException, match=r'Tried to get an invalid dry-run-order.*'): with pytest.raises(InvalidOrderException, match=r'Tried to get an invalid dry-run-order.*'):

View File

@ -308,7 +308,6 @@ def test_backtest_results(default_conf, fee, mocker, caplog, data) -> None:
'end_date': max_date, 'end_date': max_date,
} }
) )
print(results.T)
assert len(results) == len(data.trades) assert len(results) == len(data.trades)
assert round(results["profit_percent"].sum(), 3) == round(data.profit_perc, 3) assert round(results["profit_percent"].sum(), 3) == round(data.profit_perc, 3)

View File

@ -451,7 +451,6 @@ def test_generate_text_table_strategyn(default_conf, mocker):
'| LTC/BTC | 3 | 30.00 | 90.00 ' '| LTC/BTC | 3 | 30.00 | 90.00 '
'| 1.30000000 | 45.00 | 0:20:00 | 3 | 0 |' '| 1.30000000 | 45.00 | 0:20:00 | 3 | 0 |'
) )
print(backtesting._generate_text_table_strategy(all_results=results))
assert backtesting._generate_text_table_strategy(all_results=results) == result_str assert backtesting._generate_text_table_strategy(all_results=results) == result_str

View File

@ -214,9 +214,6 @@ def test_start(mocker, default_conf, caplog) -> None:
args = get_args(args) args = get_args(args)
start_hyperopt(args) start_hyperopt(args)
import pprint
pprint.pprint(caplog.record_tuples)
assert log_has('Starting freqtrade in Hyperopt mode', caplog) assert log_has('Starting freqtrade in Hyperopt mode', caplog)
assert start_mock.call_count == 1 assert start_mock.call_count == 1
@ -239,9 +236,6 @@ def test_start_no_data(mocker, default_conf, caplog) -> None:
args = get_args(args) args = get_args(args)
start_hyperopt(args) start_hyperopt(args)
import pprint
pprint.pprint(caplog.record_tuples)
assert log_has('No data found. Terminating.', caplog) assert log_has('No data found. Terminating.', caplog)

View File

@ -27,7 +27,6 @@ from tests.conftest import (log_has, log_has_re,
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def all_conf(): def all_conf():
config_file = Path(__file__).parents[1] / "config_full.json.example" config_file = Path(__file__).parents[1] / "config_full.json.example"
print(config_file)
conf = load_config_file(str(config_file)) conf = load_config_file(str(config_file))
return conf return conf
@ -713,7 +712,6 @@ def test_load_config_test_comments() -> None:
Load config with comments Load config with comments
""" """
config_file = Path(__file__).parents[0] / "config_test_comments.json" config_file = Path(__file__).parents[0] / "config_test_comments.json"
print(config_file)
conf = load_config_file(str(config_file)) conf = load_config_file(str(config_file))
assert conf assert conf

View File

@ -970,7 +970,6 @@ def test_execute_buy(mocker, default_conf, fee, markets, limit_buy_order) -> Non
markets=PropertyMock(return_value=markets) markets=PropertyMock(return_value=markets)
) )
pair = 'ETH/BTC' pair = 'ETH/BTC'
print(buy_mm.call_args_list)
assert freqtrade.execute_buy(pair, stake_amount) assert freqtrade.execute_buy(pair, stake_amount)
assert get_bid.call_count == 1 assert get_bid.call_count == 1

View File

@ -729,7 +729,6 @@ def test_to_json(default_conf, fee):
) )
result = trade.to_json() result = trade.to_json()
assert isinstance(result, dict) assert isinstance(result, dict)
print(result)
assert result == {'trade_id': None, assert result == {'trade_id': None,
'pair': 'ETH/BTC', 'pair': 'ETH/BTC',