Unit tests, extract init_args from main, add option to README
This commit is contained in:
@@ -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())
|
||||
|
||||
18
freqtrade/tests/test_watchdog.py
Normal file
18
freqtrade/tests/test_watchdog.py
Normal 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
|
||||
Reference in New Issue
Block a user