Rehabilitate tests to new package structure

This commit is contained in:
nolash
2021-05-28 11:13:01 +02:00
parent 18a4d65784
commit 19d4e38dcf
10 changed files with 88 additions and 72 deletions

View File

@@ -60,7 +60,7 @@ keys = console
keys = generic
[logger_root]
level = WARN
#level = WARN
handlers = console
qualname =

View File

@@ -151,7 +151,7 @@ class Otx(SessionBase):
if not self.status & StatusBits.RESERVED:
status = status_str(self.status)
SessionBase.release_session(session)
raise TxStateChangeError('FUBAR on tx that has not been RESEREVED ({})'.format(status))
raise TxStateChangeError('FUBAR on tx that has not been RESERVED ({})'.format(status))
self.__set_status(StatusBits.UNKNOWN_ERROR | StatusBits.FINAL, session)
@@ -187,7 +187,7 @@ class Otx(SessionBase):
if not self.status & StatusBits.RESERVED:
status = status_str(self.status)
SessionBase.release_session(session)
raise TxStateChangeError('REJECTED on tx that has not been RESEREVED ({})'.format(status))
raise TxStateChangeError('REJECTED on tx that has not been RESERVED ({})'.format(status))
@@ -219,8 +219,8 @@ class Otx(SessionBase):
raise TxStateChangeError('OVERRIDDEN/OBSOLETED cannot be set on an entry already OBSOLETE ({})'.format(status))
self.__set_status(StatusBits.OBSOLETE, session)
#if manual:
# self.__set_status(StatusBits.MANUAL, session)
if manual:
self.manual(session=session)
self.__reset_status(StatusBits.QUEUED | StatusBits.IN_NETWORK, session)
if self.tracing:
@@ -246,6 +246,7 @@ class Otx(SessionBase):
SessionBase.release_session(session)
def retry(self, session=None):
"""Marks transaction as ready to retry after a timeout following a sendfail or a completed gas funding.
@@ -326,7 +327,7 @@ class Otx(SessionBase):
if not self.status & StatusBits.RESERVED:
status = self.status
SessionBase.release_session(session)
raise TxStateChangeError('SENT on tx that has not been RESEREVED ({})'.format(status))
raise TxStateChangeError('SENT on tx that has not been RESERVED ({})'.format(status))
self.__set_status(StatusBits.IN_NETWORK, session)
self.__reset_status(StatusBits.RESERVED | StatusBits.DEFERRED | StatusBits.QUEUED | StatusBits.LOCAL_ERROR | StatusBits.NODE_ERROR, session)
@@ -360,7 +361,7 @@ class Otx(SessionBase):
if not self.status & StatusBits.RESERVED:
status = self.status
SessionBase.release_session(session)
raise TxStateChangeError('SENDFAIL on tx that has not been RESEREVED ({})'.format(status))
raise TxStateChangeError('SENDFAIL on tx that has not been RESERVED ({})'.format(status))
self.__set_status(StatusBits.LOCAL_ERROR | StatusBits.DEFERRED, session)
self.__reset_status(StatusBits.RESERVED | StatusBits.QUEUED | StatusBits.GAS_ISSUES, session)

View File

@@ -95,7 +95,10 @@ def set_final(chain_spec, tx_hash, block=None, tx_index=None, fail=False, sessio
raise(e)
if block != None:
TxCache.set_final(o.tx_hash, block, tx_index, session=session)
try:
TxCache.set_final(o.tx_hash, block, tx_index, session=session)
except NotLocalTxError:
logg.debug('otx for {} does not have cache complement'.format(tx_hash))
session.commit()
@@ -115,7 +118,6 @@ def set_cancel(chain_spec, tx_hash, manual=False, session=None):
:type manual: boolean
:raises NotLocalTxError: If transaction not found in queue.
"""
session = SessionBase.bind_session(session)
o = Otx.load(tx_hash, session=session)
if o == None: