Add test to ensure --hyperopt-loss is mandatory
This commit is contained in:
parent
14e87ed4a1
commit
8c2f763193
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -154,7 +154,7 @@ jobs:
|
||||
run: |
|
||||
cp config.json.example config.json
|
||||
freqtrade create-userdir --userdir user_data
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt SampleHyperOpt --print-all
|
||||
freqtrade hyperopt --datadir tests/testdata -e 5 --strategy SampleStrategy --hyperopt SampleHyperOpt --hyperopt-loss SharpeHyperOptLossDaily --print-all
|
||||
|
||||
- name: Flake8
|
||||
run: |
|
||||
|
@ -82,8 +82,4 @@ class HyperOptLossResolver(IResolver):
|
||||
hyperoptloss.__class__.ticker_interval = str(config['timeframe'])
|
||||
hyperoptloss.__class__.timeframe = str(config['timeframe'])
|
||||
|
||||
if not hasattr(hyperoptloss, 'hyperopt_loss_function'):
|
||||
raise OperationalException(
|
||||
f"Found HyperoptLoss class {hyperoptloss_name} does not "
|
||||
"implement `hyperopt_loss_function`.")
|
||||
return hyperoptloss
|
||||
|
@ -230,6 +230,13 @@ def test_hyperoptresolver_noname(default_conf):
|
||||
HyperOptResolver.load_hyperopt(default_conf)
|
||||
|
||||
|
||||
def test_hyperoptlossresolver_noname(default_conf):
|
||||
with pytest.raises(OperationalException,
|
||||
match="No Hyperopt loss set. Please use `--hyperopt-loss` to specify "
|
||||
"the Hyperopt-Loss class to use."):
|
||||
HyperOptLossResolver.load_hyperoptloss(default_conf)
|
||||
|
||||
|
||||
def test_hyperoptlossresolver(mocker, default_conf) -> None:
|
||||
|
||||
hl = DefaultHyperOptLoss
|
||||
|
Loading…
Reference in New Issue
Block a user