cmdtest_d.base: new utf8_suf property
This commit is contained in:
parent
21060b2c92
commit
545a685e30
5 changed files with 21 additions and 17 deletions
|
|
@ -78,9 +78,13 @@ class CmdTestBase:
|
|||
fork = 'btc' if coin == 'bch' and not cashaddr else coin
|
||||
return '' if fork == 'btc' else f'-{coin.upper()}'
|
||||
|
||||
@property
|
||||
def utf8_suf(self):
|
||||
return '-α' if self.cfg.debug_utf8 else ''
|
||||
|
||||
@property
|
||||
def tmpdir(self):
|
||||
return os.path.join('test', 'tmp', '{}{}'.format(self.tmpdir_num, '-α' if self.cfg.debug_utf8 else ''))
|
||||
return os.path.join('test', 'tmp', '{}{}'.format(self.tmpdir_num, self.utf8_suf))
|
||||
|
||||
def get_file_with_ext(self, ext, **kwargs):
|
||||
return get_file_with_ext(self.tmpdir, ext, **kwargs)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class CmdTestEthBumpMethods:
|
|||
|
||||
def _txbump_new_outputs(self, *, args, fee, add_opts=[]):
|
||||
self.get_file_with_ext('rawtx', delete_all=True)
|
||||
ext = '{}.regtest.sigtx'.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = f'{self.utf8_suf}.regtest.sigtx'
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
return self.txbump_ui_common(
|
||||
self.spawn('mmgen-txbump', self.eth_opts + add_opts + args + [txfile]),
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class CmdTestEthdevMethods:
|
|||
add_args = [],
|
||||
bad_input = False,
|
||||
exit_val = None):
|
||||
ext = ext.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext.format(self.utf8_suf)
|
||||
fn = self.get_file_with_ext(ext, no_dot=True, delete=False)
|
||||
t = self.spawn(
|
||||
'mmgen-addrimport',
|
||||
|
|
@ -197,7 +197,7 @@ class CmdTestEthdevMethods:
|
|||
return t
|
||||
|
||||
def _txbump(self, *, fee, ext, add_opts=[], add_args=[]):
|
||||
ext = ext.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext.format(self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn('mmgen-txbump', self.eth_opts + add_opts + ['--yes', txfile] + add_args)
|
||||
t.expect('or gas price: ', fee+'\n')
|
||||
|
|
@ -300,7 +300,7 @@ class CmdTestEthdevMethods:
|
|||
t = self.spawn('mmgen-'+mmgen_cmd, self.eth_opts + args)
|
||||
if mmgen_cmd == 'txcreate':
|
||||
t.written_to_file('transaction')
|
||||
ext = '[0,8000]{}.regtest.rawtx'.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = '[0,8000]{}.regtest.rawtx'.format(self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn(
|
||||
'mmgen-txsign',
|
||||
|
|
@ -1005,7 +1005,7 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
return t
|
||||
|
||||
def txsign(self, ni=False, ext='{}.regtest.rawtx', add_args=[], dev_send=False, has_label=True):
|
||||
ext = ext.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext.format(self.utf8_suf)
|
||||
keyfile = joinpath(self.tmpdir, dfl_devkey_fn)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn(
|
||||
|
|
@ -1027,7 +1027,7 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
return_early = False,
|
||||
has_label = True,
|
||||
env = {}):
|
||||
ext = ext.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext.format(self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn(
|
||||
'mmgen-txsend',
|
||||
|
|
@ -1045,7 +1045,7 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
return t
|
||||
|
||||
def txview(self, ext_fs):
|
||||
ext = ext_fs.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext_fs.format(self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
return self.spawn('mmgen-tool', ['--verbose', 'txview', txfile])
|
||||
|
||||
|
|
@ -1148,7 +1148,7 @@ class CmdTestEthdev(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
|
||||
def tx_status(self, ext, *, expect_str, expect_str2='', add_opts=[], exit_val=0):
|
||||
self.mining_delay()
|
||||
ext = ext.format('-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ext.format(self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, no_dot=True)
|
||||
t = self.spawn(
|
||||
'mmgen-txsend',
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ class CmdTestRef3Seed(CmdTestBase, CmdTestShared):
|
|||
pat = r'{}-[0-9A-F]{{8}}\[{},1\]{}.mmdat'.format(
|
||||
self.chk_data['sids'][idx],
|
||||
self.chk_data['lens'][idx],
|
||||
'-α' if self.cfg.debug_utf8 else '')
|
||||
self.utf8_suf)
|
||||
assert re.match(pat, fn), f'{pat} != {fn}'
|
||||
sid = os.path.basename(fn.split('-')[0])
|
||||
cmp_or_die(sid, self.seed_id, desc='Seed ID')
|
||||
|
|
@ -183,7 +183,7 @@ class CmdTestRef3Seed(CmdTestBase, CmdTestShared):
|
|||
pat = re_pat.format(sid, slen)
|
||||
assert re.match(pat, fn), f'{pat} != {fn}'
|
||||
else:
|
||||
cmp_or_die('{}[{}]{}.{}'.format(sid, slen, '-α' if self.cfg.debug_utf8 else '', wcls.ext), fn)
|
||||
cmp_or_die('{}[{}]{}.{}'.format(sid, slen, self.utf8_suf, wcls.ext), fn)
|
||||
return t
|
||||
|
||||
def ref_walletconv_words(self):
|
||||
|
|
@ -201,7 +201,7 @@ class CmdTestRef3Seed(CmdTestBase, CmdTestShared):
|
|||
|
||||
def ref_walletconv_incog(self, ofmt='incog', ext='mmincog'):
|
||||
args = ['-r0', '-p1']
|
||||
pat = r'{}-[0-9A-F]{{8}}-[0-9A-F]{{8}}\[{},1\]' + ('-α' if self.cfg.debug_utf8 else '') + '.' + ext
|
||||
pat = r'{}-[0-9A-F]{{8}}-[0-9A-F]{{8}}\[{},1\]' + self.utf8_suf + '.' + ext
|
||||
return self.ref_walletconv(ofmt=ofmt, extra_args=args, re_pat=pat)
|
||||
|
||||
def ref_walletconv_hexincog(self):
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
self.get_altcoin_pfx(proto.coin),
|
||||
id_strs[desc],
|
||||
addr_range,
|
||||
'-α' if self.cfg.debug_utf8 else ''))
|
||||
self.utf8_suf))
|
||||
if mmtype == proto.mmtypes[0] and user == 'bob':
|
||||
self._add_comments_to_addr_file(proto, addrfile, addrfile, use_comments=True)
|
||||
t = self.spawn(
|
||||
|
|
@ -1184,7 +1184,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
self.get_altcoin_pfx(proto.coin),
|
||||
id_str,
|
||||
addr_range,
|
||||
'-α' if self.cfg.debug_utf8 else '')
|
||||
self.utf8_suf)
|
||||
addrfile = get_file_with_ext(self._user_dir(user), ext, no_dot=True)
|
||||
silence()
|
||||
addr = AddrList(self.cfg, proto, infile=addrfile).data[idx].addr
|
||||
|
|
@ -1205,7 +1205,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
def bob_rbf_1output_bump(self):
|
||||
if not self.test_rbf:
|
||||
return 'skip'
|
||||
ext = '9343,3]{x}.regtest.rawtx'.format(x='-α' if self.cfg.debug_utf8 else '')
|
||||
ext = f'9343,3]{self.utf8_suf}.regtest.rawtx'
|
||||
txfile = get_file_with_ext(self.tr.trash_dir, ext, delete=False, no_dot=True)
|
||||
return self.user_txbump('bob',
|
||||
self.tr.trash_dir,
|
||||
|
|
@ -1278,7 +1278,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
return self._bob_rbf_bump(['--send'], rtFee[2])
|
||||
|
||||
def _bob_rbf_bump(self, add_args, fee):
|
||||
ext = ',{}]{x}.regtest.sigtx'.format(rtFee[1][:-1], x='-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ',{}]{}.regtest.sigtx'.format(rtFee[1][:-1], self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, delete=False, no_dot=True)
|
||||
return self.user_txbump('bob', self.tmpdir, txfile, fee, add_args=add_args)
|
||||
|
||||
|
|
@ -1341,7 +1341,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
|
|||
r1, r2 = (f'Transaction has {confirmations} confirmation', '')
|
||||
else:
|
||||
r1, r2 = ('in mempool, replaceable', '')
|
||||
ext = ',{}]{x}.regtest.sigtx'.format(fee[:-1], x='-α' if self.cfg.debug_utf8 else '')
|
||||
ext = ',{}]{}.regtest.sigtx'.format(fee[:-1], self.utf8_suf)
|
||||
txfile = self.get_file_with_ext(ext, delete=False, no_dot=True)
|
||||
return self.user_txsend_status('bob', txfile, r1, r2, exit_val=exit_val)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue