allow tests to run in random mode
This commit is contained in:
parent
9019f6492f
commit
c217b58f33
@ -46,7 +46,7 @@ def get_patched_freqtradebot(mocker, config) -> FreqtradeBot:
|
|||||||
return FreqtradeBot(config, create_engine('sqlite://'))
|
return FreqtradeBot(config, create_engine('sqlite://'))
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="function")
|
||||||
def default_conf():
|
def default_conf():
|
||||||
""" Returns validated configuration suitable for most tests """
|
""" Returns validated configuration suitable for most tests """
|
||||||
configuration = {
|
configuration = {
|
||||||
|
@ -16,9 +16,9 @@ from freqtrade.tests.conftest import log_has
|
|||||||
API_INIT = False
|
API_INIT = False
|
||||||
|
|
||||||
|
|
||||||
def maybe_init_api(conf, mocker):
|
def maybe_init_api(conf, mocker, force=False):
|
||||||
global API_INIT
|
global API_INIT
|
||||||
if not API_INIT:
|
if force or not API_INIT:
|
||||||
mocker.patch('freqtrade.exchange.validate_pairs',
|
mocker.patch('freqtrade.exchange.validate_pairs',
|
||||||
side_effect=lambda s: True)
|
side_effect=lambda s: True)
|
||||||
init(config=conf)
|
init(config=conf)
|
||||||
@ -27,7 +27,7 @@ def maybe_init_api(conf, mocker):
|
|||||||
|
|
||||||
def test_init(default_conf, mocker, caplog):
|
def test_init(default_conf, mocker, caplog):
|
||||||
caplog.set_level(logging.INFO)
|
caplog.set_level(logging.INFO)
|
||||||
maybe_init_api(default_conf, mocker)
|
maybe_init_api(default_conf, mocker, True)
|
||||||
assert log_has('Instance is running with dry_run enabled', caplog.record_tuples)
|
assert log_has('Instance is running with dry_run enabled', caplog.record_tuples)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user