Browse Source

minor cleanups

The MMGen Project 2 years ago
parent
commit
d2a3e22790

+ 1 - 1
mmgen/proto/btc/tw/txhistory.py

@@ -17,7 +17,7 @@ from ....globalvars import g
 from ....tw.txhistory import TwTxHistory
 from ....tw.common import get_tw_label,TwMMGenID
 from ....addr import CoinAddr
-from ....util import msg,msg_r,remove_dups
+from ....util import msg,msg_r
 from ....color import nocolor,red,pink,gray
 from ....obj import TwComment,CoinTxID,Int
 from .common import BitcoinTwCommon

+ 1 - 1
test/test_py_d/ts_cfg.py

@@ -7,7 +7,7 @@
 # Licensed according to the terms of GPL Version 3.  See LICENSE for details.
 
 """
-ts_misc.py: CfgFile tests for the MMGen test.py test suite
+ts_cfg.py: CfgFile tests for the MMGen test.py test suite
 """
 
 import shutil

+ 27 - 10
test/test_py_d/ts_misc.py

@@ -82,6 +82,15 @@ class TestSuiteHelp(TestSuiteBase):
 		t.expect('MMGEN-TOOL version')
 		return t
 
+	def spawn_chk_expect(self,*args,**kwargs):
+		expect = kwargs.pop('expect')
+		t = self.spawn(*args,**kwargs)
+		t.expect(expect)
+		t.read()
+		t.ok()
+		t.skip_ok = True
+		return t
+
 	def helpscreens(self,arg='--help',scripts=(),expect='USAGE:.*OPTIONS:'):
 
 		scripts = list(scripts) or [s.replace('mmgen-','') for s in os.listdir('cmds')]
@@ -119,12 +128,15 @@ class TestSuiteHelp(TestSuiteBase):
 			ymsg('Skipping tool help with PYTHONOPTIMIZE=2 (no docstrings)')
 			return 'skip'
 
-		for args in (
-			['help'],
-			['usage'],
-			['help','randpair']
+		for arg in (
+			'help',
+			'usage',
 		):
-			t = self.spawn_chk('mmgen-tool',args,extra_desc=f"('mmgen-tool {fmt_list(args,fmt='bare')}')")
+			t = self.spawn_chk_expect(
+				'mmgen-tool',
+				[arg],
+				extra_desc = f'(mmgen-tool {arg})',
+				expect = 'GENERAL USAGE' )
 		return t
 
 	def tool_cmd_usage(self):
@@ -141,12 +153,17 @@ class TestSuiteHelp(TestSuiteBase):
 		return t
 
 	def test_help(self):
-		for args in (
-			['--help'],
-			['--list-cmds'],
-			['--list-cmd-groups']
+		for arg,expect in (
+			('--help','USAGE'),
+			('--list-cmds','AVAILABLE COMMANDS'),
+			('--list-cmd-groups','AVAILABLE COMMAND GROUPS')
 		):
-			t = self.spawn_chk('test.py',args,cmd_dir='test',extra_desc=f"('test.py {fmt_list(args,fmt='bare')}')")
+			t = self.spawn_chk_expect(
+				'test.py',
+				[arg],
+				cmd_dir = 'test',
+				extra_desc = f'(test.py {arg})',
+				expect = expect )
 		return t
 
 class TestSuiteOutput(TestSuiteBase):

+ 1 - 1
test/test_py_d/ts_regtest.py

@@ -867,7 +867,7 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
 		txfile = self.get_file_with_ext(ext,delete=False,no_dot=True)
 		return self.user_txbump('bob',self.tmpdir,txfile,rtFee[2],add_args=['--send'])
 
-	def generate(self,coin=None,num_blocks=1):
+	def generate(self,num_blocks=1):
 		int(num_blocks)
 		t = self.spawn('mmgen-regtest',['generate',str(num_blocks)])
 		t.expect(f'Mined {num_blocks} block')