Remove Strategy fallback to default strategy

This commit is contained in:
Gerald Lonlas
2018-01-31 22:31:41 -08:00
parent 0a42a0e814
commit d844973e45
4 changed files with 27 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ def test_load_strategy(result):
strategy.logger = logging.getLogger(__name__)
assert not hasattr(Strategy, 'custom_strategy')
strategy._load_strategy('default_strategy')
strategy._load_strategy('test_strategy')
assert not hasattr(Strategy, 'custom_strategy')
@@ -40,6 +40,18 @@ def test_load_strategy(result):
assert 'adx' in strategy.populate_indicators(result)
def test_load_not_found_strategy(caplog):
strategy = Strategy()
strategy.logger = logging.getLogger(__name__)
assert not hasattr(Strategy, 'custom_strategy')
strategy._load_strategy('NotFoundStrategy')
error_msg = "Impossible to load Strategy 'user_data/strategies/{}.py'. This file does not " \
"exist or contains Python code errors".format('NotFoundStrategy')
assert ('test_strategy', logging.ERROR, error_msg) in caplog.record_tuples
def test_strategy(result):
strategy = Strategy()
strategy.init({'strategy': 'default_strategy'})