Unit tests, extract init_args from main, add option to README

This commit is contained in:
Anton Ermak
2018-01-09 15:59:58 +07:00
parent 5ba255f635
commit 2b754d2662
5 changed files with 54 additions and 11 deletions

View File

@@ -37,6 +37,14 @@ def test_parse_args_backtesting(mocker):
assert call_args.ticker_interval == 5
def test_init_args():
sysargv = ['--config', 'config.json.example']
args, watchdog = main.init_args(sysargv)
assert args.config == 'config.json.example'
assert main._CONF['stake_currency'] == 'BTC'
assert watchdog.timeout == 300
def test_main_start_hyperopt(mocker):
hyperopt_mock = mocker.patch(
'freqtrade.optimize.hyperopt.start', MagicMock())

View File

@@ -0,0 +1,18 @@
from freqtrade.watchdog import Watchdog
def test_watchdog_timeout(caplog):
watchdog = Watchdog(1)
assert(watchdog.run(0) is False)
log = ["Watchdog started", "Kill process due to timeout"]
for line in log:
assert line in caplog.text
def test_watchdog_kill(caplog):
watchdog = Watchdog(1)
watchdog.exit_gracefully(1, 0)
assert(watchdog.run(0) is False)
log = ["Watchdog started", "Watchdog stopped"]
for line in log:
assert line in caplog.text