Browse Source

test/test.py: no_msg option for MMGenPexpect

MMGen 7 years ago
parent
commit
d5d81b8c02
2 changed files with 13 additions and 11 deletions
  1. 10 9
      test/mmgen_pexpect.py
  2. 3 2
      test/test.py

+ 10 - 9
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
 

+ 3 - 2
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