Fix missing session passing for nonce reserve teste
This commit is contained in:
parent
6f3069b90c
commit
bb92b417e2
@ -27,7 +27,7 @@ def database_engine(
|
|||||||
SessionBase.poolable = False
|
SessionBase.poolable = False
|
||||||
dsn = dsn_from_config(load_config)
|
dsn = dsn_from_config(load_config)
|
||||||
#SessionBase.connect(dsn, True)
|
#SessionBase.connect(dsn, True)
|
||||||
SessionBase.connect(dsn, debug=load_config.get('DATABASE_DEBUG') != None)
|
SessionBase.connect(dsn, debug=load_config.true('DATABASE_DEBUG'))
|
||||||
return dsn
|
return dsn
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ def get_upcoming_tx(chain_spec, status=StatusEnum.READYSEND, not_status=None, re
|
|||||||
q_outer = q_outer.join(Lock, isouter=True)
|
q_outer = q_outer.join(Lock, isouter=True)
|
||||||
q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
|
||||||
|
|
||||||
|
|
||||||
if not is_alive(status):
|
if not is_alive(status):
|
||||||
SessionBase.release_session(session)
|
SessionBase.release_session(session)
|
||||||
raise ValueError('not a valid non-final tx value: {}'.format(status))
|
raise ValueError('not a valid non-final tx value: {}'.format(status))
|
||||||
|
@ -6,4 +6,4 @@ HOST=localhost
|
|||||||
PORT=5432
|
PORT=5432
|
||||||
ENGINE=sqlite
|
ENGINE=sqlite
|
||||||
DRIVER=pysqlite
|
DRIVER=pysqlite
|
||||||
DEBUG=
|
DEBUG=0
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# third-party imports
|
# extended imports
|
||||||
import pytest
|
import pytest
|
||||||
import uuid
|
import uuid
|
||||||
|
import unittest
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.db.models.nonce import (
|
from cic_eth.db.models.nonce import (
|
||||||
@ -55,7 +56,7 @@ def test_nonce_reserve(
|
|||||||
o = q.first()
|
o = q.first()
|
||||||
assert o.nonce == 43
|
assert o.nonce == 43
|
||||||
|
|
||||||
nonce = NonceReservation.release(eth_empty_accounts[0], str(uu))
|
nonce = NonceReservation.release(eth_empty_accounts[0], str(uu), session=init_database)
|
||||||
init_database.commit()
|
init_database.commit()
|
||||||
assert nonce == (str(uu), 42)
|
assert nonce == (str(uu), 42)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user