From d5d81b8c0263c1677e5d0b01949bca818889d51b Mon Sep 17 00:00:00 2001 From: MMGen Date: Mon, 26 Feb 2018 12:31:47 +0000 Subject: [PATCH] test/test.py: no_msg option for MMGenPexpect --- test/mmgen_pexpect.py | 19 ++++++++++--------- test/test.py | 5 +++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/mmgen_pexpect.py b/test/mmgen_pexpect.py index 5319585b..d067874b 100755 --- a/test/mmgen_pexpect.py +++ b/test/mmgen_pexpect.py @@ -92,7 +92,7 @@ class MMGenPexpect(object): atexit.register(lambda: os.system('stty sane')) NL = '\n' - def __init__(self,name,mmgen_cmd,cmd_args,desc,no_output=False,passthru_args=[],msg_only=False): + def __init__(self,name,mmgen_cmd,cmd_args,desc,no_output=False,passthru_args=[],msg_only=False,no_msg=False): cmd_args = ['--{}{}'.format(k.replace('_','-'), '='+getattr(opt,k) if getattr(opt,k) != True else '' ) for k in passthru_args if getattr(opt,k)] \ @@ -118,14 +118,15 @@ class MMGenPexpect(object): if opt.log: log_fd.write(cmd_str+'\n') - if opt.verbose or opt.print_cmdline or opt.exact_output: - clr1,clr2,eol = ((green,cyan,'\n'),(nocolor,nocolor,' '))[bool(opt.print_cmdline)] - sys.stderr.write(green('Testing: {}\n'.format(desc))) - if not msg_only: - sys.stderr.write(clr1('Executing {}{}'.format(clr2(cmd_str),eol))) - else: - m = 'Testing %s: ' % desc - msg_r(m) + if not no_msg: + if opt.verbose or opt.print_cmdline or opt.exact_output: + clr1,clr2,eol = ((green,cyan,'\n'),(nocolor,nocolor,' '))[bool(opt.print_cmdline)] + sys.stderr.write(green('Testing: {}\n'.format(desc))) + if not msg_only: + sys.stderr.write(clr1('Executing {}{}'.format(clr2(cmd_str),eol))) + else: + m = 'Testing %s: ' % desc + msg_r(m) if msg_only: return diff --git a/test/test.py b/test/test.py index 76bb22df..0168a87e 100755 --- a/test/test.py +++ b/test/test.py @@ -981,7 +981,7 @@ def verify_checksum_or_exit(checksum,chk): from test.mmgen_pexpect import MMGenPexpect class MMGenExpect(MMGenPexpect): - def __init__(self,name,mmgen_cmd,cmd_args=[],extra_desc='',no_output=False,msg_only=False): + def __init__(self,name,mmgen_cmd,cmd_args=[],extra_desc='',no_output=False,msg_only=False,no_msg=False): desc = ((cmd_data[name][1],name)[bool(opt.names)] + (' ' + extra_desc)).strip() passthru_args = ['testnet','rpc_host','rpc_port','regtest','coin'] @@ -1000,7 +1000,8 @@ class MMGenExpect(MMGenPexpect): desc, no_output=no_output, passthru_args=passthru_args, - msg_only=msg_only) + msg_only=msg_only, + no_msg=no_msg) def create_fake_unspent_entry(coinaddr,al_id=None,idx=None,lbl=None,non_mmgen=False,segwit=False): if 'S' not in g.proto.mmtypes: segwit = False