mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Address test-failures due to file moves
This commit is contained in:
parent
1d2ef5c2ce
commit
084efc98d7
|
@ -869,6 +869,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
'--datadir', str(testdatadir),
|
'--datadir', str(testdatadir),
|
||||||
|
'--strategy-path', str(Path(__file__).parents[2] / 'freqtrade/templates'),
|
||||||
'--ticker-interval', '1m',
|
'--ticker-interval', '1m',
|
||||||
'--timerange', '1510694220-1510700340',
|
'--timerange', '1510694220-1510700340',
|
||||||
'--enable-position-stacking',
|
'--enable-position-stacking',
|
||||||
|
|
|
@ -36,13 +36,15 @@ def test_search_strategy():
|
||||||
|
|
||||||
|
|
||||||
def test_load_strategy(default_conf, result):
|
def test_load_strategy(default_conf, result):
|
||||||
default_conf.update({'strategy': 'SampleStrategy'})
|
default_conf.update({'strategy': 'SampleStrategy',
|
||||||
|
'strategy_path': str(Path(__file__).parents[2] / 'freqtrade/templates')
|
||||||
|
})
|
||||||
resolver = StrategyResolver(default_conf)
|
resolver = StrategyResolver(default_conf)
|
||||||
assert 'rsi' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
assert 'rsi' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
|
||||||
|
|
||||||
|
|
||||||
def test_load_strategy_base64(result, caplog, default_conf):
|
def test_load_strategy_base64(result, caplog, default_conf):
|
||||||
with open("user_data/strategies/sample_strategy.py", "rb") as file:
|
with (Path(__file__).parents[2] / 'freqtrade/templates/sample_strategy.py').open("rb") as file:
|
||||||
encoded_string = urlsafe_b64encode(file.read()).decode("utf-8")
|
encoded_string = urlsafe_b64encode(file.read()).decode("utf-8")
|
||||||
default_conf.update({'strategy': 'SampleStrategy:{}'.format(encoded_string)})
|
default_conf.update({'strategy': 'SampleStrategy:{}'.format(encoded_string)})
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ def test_load_strategy_invalid_directory(result, caplog, default_conf):
|
||||||
default_conf['strategy'] = 'SampleStrategy'
|
default_conf['strategy'] = 'SampleStrategy'
|
||||||
resolver = StrategyResolver(default_conf)
|
resolver = StrategyResolver(default_conf)
|
||||||
extra_dir = Path.cwd() / 'some/path'
|
extra_dir = Path.cwd() / 'some/path'
|
||||||
resolver._load_strategy('SampleStrategy', config=default_conf, extra_dir=extra_dir)
|
resolver._load_strategy('DefaultStrategy', config=default_conf, extra_dir=extra_dir)
|
||||||
|
|
||||||
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog)
|
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog)
|
||||||
|
|
||||||
|
|
|
@ -442,6 +442,7 @@ def test_create_datadir_failed(caplog):
|
||||||
|
|
||||||
def test_create_datadir(caplog, mocker):
|
def test_create_datadir(caplog, mocker):
|
||||||
cud = mocker.patch("freqtrade.utils.create_userdata_dir", MagicMock())
|
cud = mocker.patch("freqtrade.utils.create_userdata_dir", MagicMock())
|
||||||
|
csf = mocker.patch("freqtrade.utils.copy_sample_files", MagicMock())
|
||||||
args = [
|
args = [
|
||||||
"create-userdir",
|
"create-userdir",
|
||||||
"--userdir",
|
"--userdir",
|
||||||
|
@ -450,6 +451,7 @@ def test_create_datadir(caplog, mocker):
|
||||||
start_create_userdir(get_args(args))
|
start_create_userdir(get_args(args))
|
||||||
|
|
||||||
assert cud.call_count == 1
|
assert cud.call_count == 1
|
||||||
|
assert csf.call_count == 1
|
||||||
assert len(caplog.record_tuples) == 0
|
assert len(caplog.record_tuples) == 0
|
||||||
|
|
||||||
|
|
||||||
|
|
0
user_data/hyperopts/.gitkeep
Normal file
0
user_data/hyperopts/.gitkeep
Normal file
0
user_data/strategies/.gitkeep
Normal file
0
user_data/strategies/.gitkeep
Normal file
Loading…
Reference in New Issue
Block a user