Merge branch 'develop' into feat/short

This commit is contained in:
Matthias
2022-02-23 06:27:56 +01:00
29 changed files with 252 additions and 202 deletions

View File

@@ -38,13 +38,17 @@ def test_init_custom_db_url(default_conf, tmpdir):
init_db(default_conf['db_url'], default_conf['dry_run'])
assert Path(filename).is_file()
r = Trade._session.execute(text("PRAGMA journal_mode"))
assert r.first() == ('wal',)
def test_init_invalid_db_url(default_conf):
def test_init_invalid_db_url():
# Update path to a value other than default, but still in-memory
default_conf.update({'db_url': 'unknown:///some.url'})
with pytest.raises(OperationalException, match=r'.*no valid database URL*'):
init_db(default_conf['db_url'], default_conf['dry_run'])
init_db('unknown:///some.url', True)
with pytest.raises(OperationalException, match=r'Bad db-url.*For in-memory database, pl.*'):
init_db('sqlite:///', True)
def test_init_prod_db(default_conf, mocker):
@@ -2080,11 +2084,14 @@ def test_select_order(fee, is_short):
order = trades[4].select_order(trades[4].enter_side, False)
assert order is not None
trades[4].orders[1].ft_order_side = trades[4].exit_side
order = trades[4].select_order(trades[4].exit_side, True)
assert order is not None
trades[4].orders[1].ft_order_side = 'stoploss'
order = trades[4].select_order('stoploss', None)
assert order is not None
assert order.ft_order_side == 'stoploss'
order = trades[4].select_order(trades[4].exit_side, False)
assert order is None
def test_Trade_object_idem():