test suite: improve handling of BOGUS_SEND environment var
This commit is contained in:
parent
4c35218fc2
commit
b400b26029
3 changed files with 15 additions and 19 deletions
|
|
@ -316,6 +316,10 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
from mmgen.daemon import CoinDaemon
|
||||
self.rpc_port = CoinDaemon(proto=self.proto,test_suite=True).rpc_port
|
||||
self.using_solc = check_solc_ver()
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
|
||||
def __del__(self):
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
|
||||
@property
|
||||
def eth_args(self):
|
||||
|
|
@ -506,12 +510,10 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
+ ['-k', keyfile, txfile, dfl_words_file] )
|
||||
return self.txsign_ui_common(t,ni=ni,has_label=True)
|
||||
|
||||
def txsend(self,ni=False,bogus_send=False,ext='{}.regtest.sigtx',add_args=[]):
|
||||
def txsend(self,ni=False,ext='{}.regtest.sigtx',add_args=[]):
|
||||
ext = ext.format('-α' if g.debug_utf8 else '')
|
||||
txfile = self.get_file_with_ext(ext,no_dot=True)
|
||||
if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
t = self.spawn('mmgen-txsend', self.eth_args + add_args + [txfile])
|
||||
if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
txid = self.txsend_ui_common(t,
|
||||
quiet = not g.debug,
|
||||
bogus_send = False,
|
||||
|
|
@ -710,7 +712,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
async def token_deploy(self,num,key,gas,mmgen_cmd='txdo',tx_fee='8G'):
|
||||
keyfile = joinpath(self.tmpdir,openethereum_key_fn)
|
||||
fn = joinpath(self.tmpdir,'mm'+str(num),key+'.bin')
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
args = ['-B',
|
||||
'--tx-fee='+tx_fee,
|
||||
'--tx-gas={}'.format(gas),
|
||||
|
|
@ -729,7 +730,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
txfile = txfile.replace('.rawtx','.sigtx')
|
||||
t = self.spawn('mmgen-txsend', self.eth_args + [txfile],no_msg=True)
|
||||
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
txid = self.txsend_ui_common(t,
|
||||
caller = mmgen_cmd,
|
||||
quiet = mmgen_cmd == 'txdo' or not g.debug,
|
||||
|
|
@ -984,9 +984,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
fee_res_data = ('0.00105','50'),
|
||||
add_args = ['98831F3A:E:3,0.4321']):
|
||||
args = ['--tx-fee=20G','--cached-balances'] + add_args + [dfl_words_file]
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
t = self.txcreate(args=args,acct=acct,caller='txdo',fee_res_data=fee_res_data,no_read=True)
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
self._do_confirm_send(t,quiet=not g.debug,sure=False)
|
||||
t.read()
|
||||
return t
|
||||
|
|
|
|||
|
|
@ -509,10 +509,8 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
|
|||
os.system(cmd)
|
||||
return t
|
||||
|
||||
def txsend(self,sigfile,bogus_send=True,extra_opts=[]):
|
||||
if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
def txsend(self,sigfile,extra_opts=[]):
|
||||
t = self.spawn('mmgen-txsend', extra_opts + ['-d',self.tmpdir,sigfile])
|
||||
if not bogus_send: os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
self.txsend_ui_common(t,view='t',add_comment='')
|
||||
return t
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,12 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
for k in rt_data:
|
||||
globals()[k] = rt_data[k][coin] if coin in rt_data[k] else None
|
||||
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
|
||||
def __del__(self):
|
||||
os.environ['MMGEN_TEST_SUITE_REGTEST'] = ''
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
|
||||
def _add_comments_to_addr_file(self,addrfile,outfile,use_labels=False):
|
||||
silence()
|
||||
gmsg("Adding comments to address file '{}'".format(addrfile))
|
||||
|
|
@ -528,10 +534,8 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
cmp_or_die(rtBals[6],ret)
|
||||
return t
|
||||
|
||||
def user_txsend_status(self,user,tx_file,exp1='',exp2='',extra_args=[],bogus_send=False):
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ('','1')[bool(bogus_send)]
|
||||
def user_txsend_status(self,user,tx_file,exp1='',exp2='',extra_args=[]):
|
||||
t = self.spawn('mmgen-txsend',['-d',self.tmpdir,'--'+user,'--status'] + extra_args + [tx_file])
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
if exp1: t.expect(exp1,regex=True)
|
||||
if exp2: t.expect(exp2,regex=True)
|
||||
return t
|
||||
|
|
@ -542,14 +546,12 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
do_label = False,
|
||||
bad_locktime = False,
|
||||
full_tx_view = False,
|
||||
menu = ['M'],
|
||||
bogus_send = False):
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ('','1')[bool(bogus_send)]
|
||||
menu = ['M'] ):
|
||||
|
||||
t = self.spawn('mmgen-txdo',
|
||||
['-d',self.tmpdir,'-B','--'+user] +
|
||||
(['--tx-fee='+fee] if fee else []) +
|
||||
extra_args + ([],[wf])[bool(wf)] + outputs_cl)
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
|
||||
self.txcreate_ui_common(t,
|
||||
caller = 'txdo',
|
||||
|
|
@ -629,10 +631,8 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
def user_txbump(self,user,outdir,txfile,fee,add_args=[],has_label=True,signed_tx=True,one_output=False):
|
||||
if not self.proto.cap('rbf'):
|
||||
return 'skip'
|
||||
os.environ['MMGEN_BOGUS_SEND'] = ''
|
||||
t = self.spawn('mmgen-txbump',
|
||||
['-d',outdir,'--'+user,'--tx-fee='+fee,'--output-to-reduce=c'] + add_args + [txfile])
|
||||
os.environ['MMGEN_BOGUS_SEND'] = '1'
|
||||
if not one_output:
|
||||
t.expect('OK? (Y/n): ','y') # output OK?
|
||||
t.expect('OK? (Y/n): ','y') # fee OK?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue