minor whitespace, cleanups
This commit is contained in:
parent
5adf17a85f
commit
6cd8856912
8 changed files with 22 additions and 15 deletions
|
|
@ -34,6 +34,8 @@ class GlobalConstants(Lockable):
|
|||
These values are non-configurable. They’re constant for a given machine,
|
||||
user, executable and MMGen release.
|
||||
"""
|
||||
_autolock = True
|
||||
|
||||
proj_name = 'MMGen'
|
||||
proj_url = 'https://github.com/mmgen/mmgen'
|
||||
author = 'The MMGen Project'
|
||||
|
|
@ -304,10 +306,10 @@ class GlobalConfig(Lockable):
|
|||
'eth_testnet_chain_names' )
|
||||
|
||||
# Supported environmental vars
|
||||
# The corresponding vars (lowercase, minus 'mmgen_') must be initialized in g
|
||||
# 'DISABLE_' env vars disable the corresponding var in g
|
||||
# The corresponding attributes (lowercase, without 'mmgen_') must exist in the class.
|
||||
# The 'MMGEN_DISABLE_' prefix sets the corresponding attribute to False.
|
||||
env_opts = (
|
||||
'MMGEN_DEBUG_ALL', # special: there is no g.debug_all var
|
||||
'MMGEN_DEBUG_ALL', # special: there is no `debug_all` attribute
|
||||
|
||||
'MMGEN_COLUMNS',
|
||||
'MMGEN_TEST_SUITE',
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ class bitcoin_core_daemon(CoinDaemon):
|
|||
tracking_wallet_name = 'mmgen-tracking-wallet'
|
||||
rpc_ports = _nw(8332, 18332, 18443)
|
||||
cfg_file = 'bitcoin.conf'
|
||||
nonstd_datadir = False
|
||||
datadirs = {
|
||||
'linux': [gc.home_dir,'.bitcoin'],
|
||||
'win': [os.getenv('APPDATA'),'Bitcoin']
|
||||
}
|
||||
nonstd_datadir = False
|
||||
|
||||
def init_datadir(self):
|
||||
if self.network == 'regtest' and not self.test_suite:
|
||||
|
|
|
|||
|
|
@ -34,11 +34,8 @@ class tool_cmd_base(MMGenObject):
|
|||
def __init__(self,cmdname=None,proto=None,mmtype=None):
|
||||
|
||||
if self.need_proto:
|
||||
if proto:
|
||||
self.proto = proto
|
||||
else:
|
||||
from ..protocol import init_proto_from_opts
|
||||
self.proto = init_proto_from_opts(need_amt=self.need_amt)
|
||||
from ..protocol import init_proto_from_opts
|
||||
self.proto = proto or init_proto_from_opts(need_amt=self.need_amt)
|
||||
from ..globalvars import g
|
||||
if g.token:
|
||||
self.proto.tokensym = g.token.upper()
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ class MMGenPexpect:
|
|||
r'(\b|\s)' +
|
||||
fr'\s{allrep}\s'.join(s.replace(r'.',r'\.').replace(' ',r'\s+') for s in expect_list) +
|
||||
r'(\b|\s)' )
|
||||
import re
|
||||
m = re.search(expect,res,re.DOTALL)
|
||||
assert m, f'No match found for regular expression {expect!r}'
|
||||
return m
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ class TestSuiteRef3Seed(TestSuiteBase,TestSuiteShared):
|
|||
]
|
||||
slarg = [f'-l{self.seed_len} ']
|
||||
hparg = ['-p1']
|
||||
if wtype == 'hic_wallet_old' and opt.profile: msg('')
|
||||
if wtype == 'hic_wallet_old' and opt.profile:
|
||||
msg('')
|
||||
t = self.spawn('mmgen-walletchk',
|
||||
slarg + hparg + of_arg + ic_arg,
|
||||
extra_desc=edesc)
|
||||
|
|
|
|||
|
|
@ -1385,6 +1385,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
return self.alice_add_comment_badaddr( rt_pw, 'invalid address', 2 )
|
||||
|
||||
def alice_add_comment_badaddr2(self):
|
||||
# mainnet zero address:
|
||||
addr = init_proto(self.proto.coin,network='mainnet').pubhash2addr(bytes(20),False) # mainnet zero address
|
||||
return self.alice_add_comment_badaddr( addr, 'invalid address', 2 )
|
||||
|
||||
|
|
|
|||
|
|
@ -266,10 +266,12 @@ class MMGenToolTestUtils(object):
|
|||
|
||||
def run_cmd_out(self,name,carg=None,Return=False,kwargs='',fn_idx='',extra_msg='',
|
||||
literal=False,chkdata='',hush=False,add_opts=[]):
|
||||
if carg: write_to_tmpfile(cfg,f'{name}{fn_idx}.in',carg+'\n')
|
||||
if carg:
|
||||
write_to_tmpfile(cfg,f'{name}{fn_idx}.in',carg+'\n')
|
||||
ret = self.run_cmd(name,([],[carg])[bool(carg)],kwargs=kwargs,
|
||||
extra_msg=extra_msg,add_opts=add_opts)
|
||||
if carg: vmsg('In: ' + repr(carg))
|
||||
if carg:
|
||||
vmsg('In: ' + repr(carg))
|
||||
vmsg('Out: ' + (repr(ret),ret)[literal])
|
||||
if ret or ret == '':
|
||||
write_to_tmpfile(cfg,f'{name}{fn_idx}.out',ret+'\n')
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@ def cfg_file_auth_test(proto,d,bad_auth=False):
|
|||
|
||||
if bad_auth:
|
||||
os.rename(d.auth_cookie_fn,d.auth_cookie_fn+'.bak')
|
||||
try: async_run(rpc_init(proto))
|
||||
try:
|
||||
async_run(rpc_init(proto))
|
||||
except Exception as e:
|
||||
vmsg(yellow(str(e)))
|
||||
else: die(3,'No error on missing credentials!')
|
||||
else:
|
||||
die(3,'No error on missing credentials!')
|
||||
os.rename(d.auth_cookie_fn+'.bak',d.auth_cookie_fn)
|
||||
else:
|
||||
rpc = async_run(rpc_init(proto))
|
||||
|
|
@ -174,7 +176,8 @@ class unit_tests:
|
|||
passwd = None,
|
||||
daemon = md,
|
||||
)
|
||||
print_daemon_info(rpc)
|
||||
if opt.verbose:
|
||||
print_daemon_info(rpc)
|
||||
rpc.call_raw('get_height')
|
||||
rpc.call('get_last_block_header')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue