Skip to content

Commit

Permalink
Address test-failures due to file moves
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Nov 21, 2019
1 parent 1d2ef5c commit 084efc9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/optimize/test_backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ async def load_pairs(pair, timeframe, since):
'backtesting',
'--config', 'config.json',
'--datadir', str(testdatadir),
'--strategy-path', str(Path(__file__).parents[2] / 'freqtrade/templates'),
'--ticker-interval', '1m',
'--timerange', '1510694220-1510700340',
'--enable-position-stacking',
Expand Down
8 changes: 5 additions & 3 deletions tests/strategy/test_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ def test_search_strategy():


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)
assert 'rsi' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})


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")
default_conf.update({'strategy': 'SampleStrategy:{}'.format(encoded_string)})

Expand All @@ -57,7 +59,7 @@ def test_load_strategy_invalid_directory(result, caplog, default_conf):
default_conf['strategy'] = 'SampleStrategy'
resolver = StrategyResolver(default_conf)
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)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def test_create_datadir_failed(caplog):

def test_create_datadir(caplog, mocker):
cud = mocker.patch("freqtrade.utils.create_userdata_dir", MagicMock())
csf = mocker.patch("freqtrade.utils.copy_sample_files", MagicMock())
args = [
"create-userdir",
"--userdir",
Expand All @@ -450,6 +451,7 @@ def test_create_datadir(caplog, mocker):
start_create_userdir(get_args(args))

assert cud.call_count == 1
assert csf.call_count == 1
assert len(caplog.record_tuples) == 0


Expand Down
Empty file added user_data/hyperopts/.gitkeep
Empty file.
Empty file added user_data/strategies/.gitkeep
Empty file.

0 comments on commit 084efc9

Please sign in to comment.