updated unit test - this file was trying to create a dir in / of the host OS, should never have worked?
updated configuration.py call to os to be more pythony!
This commit is contained in:
parent
343ca8fe19
commit
732523544f
@ -4,7 +4,7 @@ This module contains the configuration class
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
from os import path, makedirs
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from typing import Optional, Dict, Any
|
from typing import Optional, Dict, Any
|
||||||
from jsonschema import Draft4Validator, validate
|
from jsonschema import Draft4Validator, validate
|
||||||
@ -150,15 +150,15 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
exchange = config.get('exchange', {}).get('name').lower()
|
exchange = config.get('exchange', {}).get('name').lower()
|
||||||
if exchange:
|
if exchange:
|
||||||
default = os.path.join('freqtrade', 'tests', 'testdata', exchange)
|
default = path.join('freqtrade', 'tests', 'testdata', exchange)
|
||||||
config.update({'datadir': default})
|
config.update({'datadir': default})
|
||||||
# What if user has no exchange as arg or in file - set catchall
|
# What if user has no exchange as arg or in file - set catchall
|
||||||
else:
|
else:
|
||||||
logger.info("No exchange set")
|
logger.info("No exchange set")
|
||||||
default = os.path.join('freqtrade', 'tests', 'testdata', 'catchall')
|
default = path.join('freqtrade', 'tests', 'testdata', 'catchall')
|
||||||
|
|
||||||
if not os.path.exists(config['datadir']):
|
if not path.exists(config['datadir']):
|
||||||
os.makedirs(config['datadir'])
|
makedirs(config['datadir'])
|
||||||
logger.info("Made directory: %s", config['datadir'])
|
logger.info("Made directory: %s", config['datadir'])
|
||||||
|
|
||||||
logger.info('Using data folder: %s ...', config['datadir'])
|
logger.info('Using data folder: %s ...', config['datadir'])
|
||||||
|
@ -266,14 +266,14 @@ def test_setup_configuration_with_arguments(mocker, default_conf, caplog) -> Non
|
|||||||
arglist = [
|
arglist = [
|
||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
'--strategy', 'DefaultStrategy',
|
'--strategy', 'DefaultStrategy',
|
||||||
'--datadir', '/foo/bar',
|
'--datadir', 'freqtrade/tests/testdata/',
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--ticker-interval', '1m',
|
'--ticker-interval', '1m',
|
||||||
'--live',
|
'--live',
|
||||||
'--realistic-simulation',
|
'--realistic-simulation',
|
||||||
'--refresh-pairs-cached',
|
'--refresh-pairs-cached',
|
||||||
'--timerange', ':100',
|
'--timerange', ':100',
|
||||||
'--export', '/bar/foo'
|
'--export', 'user_data/data'
|
||||||
]
|
]
|
||||||
|
|
||||||
args = Arguments(arglist, '').get_parsed_arg()
|
args = Arguments(arglist, '').get_parsed_arg()
|
||||||
|
Loading…
Reference in New Issue
Block a user