Adjust imports

This commit is contained in:
Matthias 2020-01-26 10:55:39 +01:00
parent 80ed1c3e14
commit 6e85280467
5 changed files with 29 additions and 23 deletions

View File

@ -0,0 +1,6 @@
from .utils import (setup_utils_configuration, start_create_userdir, # noqa: F401
start_download_data, start_hyperopt_list,
start_hyperopt_show, start_list_exchanges,
start_list_markets, start_list_strategies,
start_list_timeframes, start_new_hyperopt,
start_new_strategy, start_test_pairlist, start_trading)

View File

@ -131,12 +131,12 @@ class Arguments:
self._build_args(optionlist=['version'], parser=self.parser) self._build_args(optionlist=['version'], parser=self.parser)
from freqtrade.optimize import start_backtesting, start_hyperopt, start_edge from freqtrade.optimize import start_backtesting, start_hyperopt, start_edge
from freqtrade.utils import (start_create_userdir, start_download_data, from freqtrade.commands import (start_create_userdir, start_download_data,
start_hyperopt_list, start_hyperopt_show, start_hyperopt_list, start_hyperopt_show,
start_list_exchanges, start_list_markets, start_list_exchanges, start_list_markets,
start_list_strategies, start_new_hyperopt, start_list_strategies, start_new_hyperopt,
start_new_strategy, start_list_timeframes, start_new_strategy, start_list_timeframes,
start_test_pairlist, start_trading) start_test_pairlist, start_trading)
from freqtrade.plot.plot_utils import start_plot_dataframe, start_plot_profit from freqtrade.plot.plot_utils import start_plot_dataframe, start_plot_profit
subparsers = self.parser.add_subparsers(dest='command', subparsers = self.parser.add_subparsers(dest='command',

View File

@ -4,7 +4,7 @@ from typing import Any, Dict
from freqtrade import constants from freqtrade import constants
from freqtrade.exceptions import DependencyException, OperationalException from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.state import RunMode from freqtrade.state import RunMode
from freqtrade.utils import setup_utils_configuration from freqtrade.commands import setup_utils_configuration
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -2,7 +2,7 @@ from typing import Any, Dict
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
from freqtrade.state import RunMode from freqtrade.state import RunMode
from freqtrade.utils import setup_utils_configuration from freqtrade.commands import setup_utils_configuration
def validate_plot_args(args: Dict[str, Any]): def validate_plot_args(args: Dict[str, Any]):

View File

@ -4,15 +4,15 @@ from unittest.mock import MagicMock, PropertyMock
import pytest import pytest
from freqtrade.commands import (setup_utils_configuration,
start_create_userdir, start_download_data,
start_hyperopt_list, start_hyperopt_show,
start_list_exchanges, start_list_markets,
start_list_strategies, start_list_timeframes,
start_new_hyperopt, start_new_strategy,
start_test_pairlist, start_trading)
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
from freqtrade.state import RunMode from freqtrade.state import RunMode
from freqtrade.utils import (setup_utils_configuration, start_create_userdir,
start_download_data, start_hyperopt_list,
start_hyperopt_show, start_list_exchanges,
start_list_markets, start_list_strategies,
start_list_timeframes, start_new_hyperopt,
start_new_strategy, start_test_pairlist,
start_trading)
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange, from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
patched_configuration_load_config_file) patched_configuration_load_config_file)
@ -451,8 +451,8 @@ def test_create_datadir(caplog, mocker):
# Added assert here to analyze random test-failures ... # Added assert here to analyze random test-failures ...
assert len(caplog.record_tuples) == 0 assert len(caplog.record_tuples) == 0
cud = mocker.patch("freqtrade.utils.create_userdata_dir", MagicMock()) cud = mocker.patch("freqtrade.commands.create_userdata_dir", MagicMock())
csf = mocker.patch("freqtrade.utils.copy_sample_files", MagicMock()) csf = mocker.patch("freqtrade.commands.copy_sample_files", MagicMock())
args = [ args = [
"create-userdir", "create-userdir",
"--userdir", "--userdir",
@ -538,7 +538,7 @@ def test_start_new_hyperopt_no_arg(mocker, caplog):
def test_download_data_keyboardInterrupt(mocker, caplog, markets): def test_download_data_keyboardInterrupt(mocker, caplog, markets):
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data', dl_mock = mocker.patch('freqtrade.commands.refresh_backtest_ohlcv_data',
MagicMock(side_effect=KeyboardInterrupt)) MagicMock(side_effect=KeyboardInterrupt))
patch_exchange(mocker) patch_exchange(mocker)
mocker.patch( mocker.patch(
@ -556,7 +556,7 @@ def test_download_data_keyboardInterrupt(mocker, caplog, markets):
def test_download_data_no_markets(mocker, caplog): def test_download_data_no_markets(mocker, caplog):
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data', dl_mock = mocker.patch('freqtrade.commands.refresh_backtest_ohlcv_data',
MagicMock(return_value=["ETH/BTC", "XRP/BTC"])) MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
patch_exchange(mocker, id='binance') patch_exchange(mocker, id='binance')
mocker.patch( mocker.patch(
@ -574,7 +574,7 @@ def test_download_data_no_markets(mocker, caplog):
def test_download_data_no_exchange(mocker, caplog): def test_download_data_no_exchange(mocker, caplog):
mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data', mocker.patch('freqtrade.commands.refresh_backtest_ohlcv_data',
MagicMock(return_value=["ETH/BTC", "XRP/BTC"])) MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
patch_exchange(mocker) patch_exchange(mocker)
mocker.patch( mocker.patch(
@ -594,7 +594,7 @@ def test_download_data_no_pairs(mocker, caplog):
mocker.patch.object(Path, "exists", MagicMock(return_value=False)) mocker.patch.object(Path, "exists", MagicMock(return_value=False))
mocker.patch('freqtrade.utils.refresh_backtest_ohlcv_data', mocker.patch('freqtrade.commands.refresh_backtest_ohlcv_data',
MagicMock(return_value=["ETH/BTC", "XRP/BTC"])) MagicMock(return_value=["ETH/BTC", "XRP/BTC"]))
patch_exchange(mocker) patch_exchange(mocker)
mocker.patch( mocker.patch(
@ -613,9 +613,9 @@ def test_download_data_no_pairs(mocker, caplog):
def test_download_data_trades(mocker, caplog): def test_download_data_trades(mocker, caplog):
dl_mock = mocker.patch('freqtrade.utils.refresh_backtest_trades_data', dl_mock = mocker.patch('freqtrade.commands.refresh_backtest_trades_data',
MagicMock(return_value=[])) MagicMock(return_value=[]))
convert_mock = mocker.patch('freqtrade.utils.convert_trades_to_ohlcv', convert_mock = mocker.patch('freqtrade.commands.convert_trades_to_ohlcv',
MagicMock(return_value=[])) MagicMock(return_value=[]))
patch_exchange(mocker) patch_exchange(mocker)
mocker.patch( mocker.patch(