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()
"""
import logging
import arrow
import copy
import json
@ -36,7 +37,7 @@ class FreqtradeBot(object):
"""
# Init the logger
self.logger = Logger(name='freqtrade').get_logger()
self.logger = Logger(name=__name__, level=config.get('loglevel')).get_logger()
# Init bot states
self._state = State.STOPPED

View File

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

View File

@ -8,7 +8,7 @@ import logging
import time
from unittest.mock import MagicMock
from copy import deepcopy
from typing import Optional
from typing import Dict, Optional
import arrow
import pytest
import requests
@ -36,7 +36,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
mocker.patch('freqtrade.freqtradebot.exchange.init', MagicMock())
patch_pymarketcap(mocker)
return FreqtradeBot(config)
return FreqtradeBot(config, create_engine('sqlite://'))
def patch_get_signal(mocker, value=(True, False)) -> None:
@ -63,7 +63,7 @@ def patch_RPCManager(mocker) -> MagicMock:
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
: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
"""
caplog.set_level(logging.INFO)
freqtrade = get_patched_freqtradebot(mocker, default_conf)
mocker.patch(