Minor updates

This commit is contained in:
Gerald Lonlas 2018-03-02 21:47:00 +08:00
parent 6ef7b7d93d
commit bc8ca491cd
3 changed files with 9 additions and 7 deletions

View File

@ -2,6 +2,7 @@
Freqtrade is the main module of this bot. It contains the class Freqtrade() Freqtrade is the main module of this bot. It contains the class Freqtrade()
""" """
import logging
import arrow import arrow
import copy import copy
import json import json
@ -36,7 +37,7 @@ class FreqtradeBot(object):
""" """
# Init the logger # Init the logger
self.logger = Logger(name='freqtrade').get_logger() self.logger = Logger(name=__name__, level=config.get('loglevel')).get_logger()
# Init bot states # Init bot states
self._state = State.STOPPED self._state = State.STOPPED

View File

@ -8,6 +8,7 @@ import arrow
import pytest import pytest
from jsonschema import validate from jsonschema import validate
from telegram import Chat, Message, Update from telegram import Chat, Message, Update
from sqlalchemy import create_engine
from freqtrade.analyze import Analyze from freqtrade.analyze import Analyze
from freqtrade.constants import Constants from freqtrade.constants import Constants
@ -41,7 +42,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
mocker.patch('freqtrade.freqtradebot.RPCManager.send_msg', MagicMock()) mocker.patch('freqtrade.freqtradebot.RPCManager.send_msg', MagicMock())
mocker.patch('freqtrade.freqtradebot.Analyze.get_signal', MagicMock()) mocker.patch('freqtrade.freqtradebot.Analyze.get_signal', MagicMock())
return FreqtradeBot(config) return FreqtradeBot(config, create_engine('sqlite://'))
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
@ -83,7 +84,8 @@ def default_conf():
"token": "token", "token": "token",
"chat_id": "0" "chat_id": "0"
}, },
"initial_state": "running" "initial_state": "running",
"loglevel": logging.DEBUG
} }
validate(configuration, Constants.CONF_SCHEMA) validate(configuration, Constants.CONF_SCHEMA)
return configuration return configuration

View File

@ -8,7 +8,7 @@ import logging
import time import time
from unittest.mock import MagicMock from unittest.mock import MagicMock
from copy import deepcopy from copy import deepcopy
from typing import Optional from typing import Dict, Optional
import arrow import arrow
import pytest import pytest
import requests import requests
@ -36,7 +36,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
mocker.patch('freqtrade.freqtradebot.exchange.init', MagicMock()) mocker.patch('freqtrade.freqtradebot.exchange.init', MagicMock())
patch_pymarketcap(mocker) patch_pymarketcap(mocker)
return FreqtradeBot(config) return FreqtradeBot(config, create_engine('sqlite://'))
def patch_get_signal(mocker, value=(True, False)) -> None: def patch_get_signal(mocker, value=(True, False)) -> None:
@ -63,7 +63,7 @@ def patch_RPCManager(mocker) -> MagicMock:
return rpc_mock return rpc_mock
def patch_pymarketcap(mocker, value: Optional[str] = None) -> None: def patch_pymarketcap(mocker, value: Optional[Dict[str, float]] = None) -> None:
""" """
Mocker to Pymarketcap to speed up tests Mocker to Pymarketcap to speed up tests
:param mocker: mocker to patch Pymarketcap class :param mocker: mocker to patch Pymarketcap class
@ -530,7 +530,6 @@ def test_process_maybe_execute_buy_exception(mocker, default_conf, caplog) -> No
""" """
Test exception on process_maybe_execute_buy() method Test exception on process_maybe_execute_buy() method
""" """
caplog.set_level(logging.INFO)
freqtrade = get_patched_freqtradebot(mocker, default_conf) freqtrade = get_patched_freqtradebot(mocker, default_conf)
mocker.patch( mocker.patch(