Merge pull request #2923 from hroff-1902/status-strategies
Add printing statuses for enlisted strategies and hyperopts
This commit is contained in:
9
tests/strategy/failing_strategy.py
Normal file
9
tests/strategy/failing_strategy.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# The strategy which fails to load due to non-existent dependency
|
||||
|
||||
import nonexiting_module # noqa
|
||||
|
||||
from freqtrade.strategy.interface import IStrategy
|
||||
|
||||
|
||||
class TestStrategyLegacy(IStrategy):
|
||||
pass
|
@@ -30,14 +30,25 @@ def test_search_strategy():
|
||||
assert s is None
|
||||
|
||||
|
||||
def test_search_all_strategies():
|
||||
def test_search_all_strategies_no_failed():
|
||||
directory = Path(__file__).parent
|
||||
strategies = StrategyResolver.search_all_objects(directory)
|
||||
strategies = StrategyResolver.search_all_objects(directory, enum_failed=False)
|
||||
assert isinstance(strategies, list)
|
||||
assert len(strategies) == 3
|
||||
assert isinstance(strategies[0], dict)
|
||||
|
||||
|
||||
def test_search_all_strategies_with_failed():
|
||||
directory = Path(__file__).parent
|
||||
strategies = StrategyResolver.search_all_objects(directory, enum_failed=True)
|
||||
assert isinstance(strategies, list)
|
||||
assert len(strategies) == 4
|
||||
# with enum_failed=True search_all_objects() shall find 3 good strategies
|
||||
# and 1 which fails to load
|
||||
assert len([x for x in strategies if x['class'] is not None]) == 3
|
||||
assert len([x for x in strategies if x['class'] is None]) == 1
|
||||
|
||||
|
||||
def test_load_strategy(default_conf, result):
|
||||
default_conf.update({'strategy': 'SampleStrategy',
|
||||
'strategy_path': str(Path(__file__).parents[2] / 'freqtrade/templates')
|
||||
|
Reference in New Issue
Block a user