move testdata file loading to pytest fixture

This commit is contained in:
Janne Sinivirta
2017-11-07 19:24:51 +02:00
parent fbbde9de25
commit 0395c92260
3 changed files with 36 additions and 29 deletions

View File

@@ -1,9 +1,7 @@
# pragma pylint: disable=missing-docstring
import json
import pytest
@pytest.fixture(scope="module")
def pairs():
return ['btc-neo', 'btc-eth', 'btc-omg', 'btc-edg', 'btc-pay',
'btc-pivx', 'btc-qtum', 'btc-mtl', 'btc-etc', 'btc-ltc']
@pytest.fixture(scope="module")
def conf():
@@ -16,3 +14,13 @@ def conf():
},
"stoploss": -0.05
}
@pytest.fixture(scope="module")
def backdata():
result = {}
for pair in ['btc-neo', 'btc-eth', 'btc-omg', 'btc-edg', 'btc-pay',
'btc-pivx', 'btc-qtum', 'btc-mtl', 'btc-etc', 'btc-ltc']:
with open('freqtrade/tests/testdata/' + pair + '.json') as data_file:
result[pair] = json.load(data_file)
return result