Browse Source

minor testing fixes

The MMGen Project 1 year ago
parent
commit
29ebec09c3

+ 2 - 1
mmgen/autosign.py

@@ -592,7 +592,8 @@ class Autosign:
 				msg('Device insertion detected')
 				await self.do_sign()
 				if testing_xmr:
-					self.dev_disk_path.unlink(missing_ok=True)
+					if self.dev_disk_path.exists():
+						self.dev_disk_path.unlink()
 			prev_status = status
 			if not n % 10:
 				msg_r(f"\r{' '*17}\rWaiting")

+ 4 - 4
test/misc/input_func.py

@@ -32,13 +32,13 @@ elif cmd in ('get_char','line_input'):
 	from mmgen.ui import line_input
 	from ast import literal_eval
 	func_args = literal_eval(cmd_args[1])
-	Msg(f'\n  term: {get_char.__self__.__name__}')
-	Msg(f'  cfg.hold_protect_disable: {cfg.hold_protect_disable}')
+	msg(f'\n  term: {get_char.__self__.__name__}')
+	msg(f'  cfg.hold_protect_disable: {cfg.hold_protect_disable}')
 	if cmd == 'line_input':
 		func_args.update({'cfg':cfg})
-	Msg('  {name}( {args} )'.format(
+	msg('  Calling {name}( {args} )'.format(
 		name = cmd,
 		args = ', '.join(f'{k}={v!r}' for k,v in func_args.items())
 		))
 	ret = locals()[cmd](**func_args)
-	Msg('  ==> {!r}'.format(ret))
+	msg('  ==> {!r}'.format(ret))

+ 2 - 0
test/test-release.sh

@@ -278,6 +278,8 @@ remove_skipped_tests
 
 check_tests
 
+test/test.py clean
+
 start_time=$(date +%s)
 
 run_tests "$tests"

+ 0 - 5
test/test.py

@@ -575,11 +575,6 @@ class TestSuiteRunner(object):
 		else:
 			self.spawn_env['MMGEN_COLUMNS'] = '120'
 
-		if os.getenv('MMGEN_DEBUG_ALL'):
-			for name in cfg._env_opts:
-				if name[:11] == 'MMGEN_DEBUG':
-					self.spawn_env[name] = '1'
-
 		if not cfg.system:
 			self.spawn_env['PYTHONPATH'] = repo_root
 

+ 6 - 1
test/test_py_d/ts_input.py

@@ -243,7 +243,12 @@ class TestSuiteInput(TestSuiteBase):
 			imsg('  {:14} {!r}'.format(k+':',v))
 		imsg_r('\nScript output: ')
 		prompt_add = (func_args['insert_txt'] if term else '') if func_name == 'line_input' else ''
-		t.expect( func_args['prompt'] + prompt_add, text )
+		prompt = func_args['prompt'] + prompt_add
+		t.expect('Calling ')
+		if prompt:
+			t.expect(prompt,text)
+		else:
+			t.send(text)
 		ret = t.expect_getend('  ==> ')
 		assert ret == repr(expect), f'Text mismatch! {ret} != {repr(expect)}'
 		return t

+ 2 - 1
test/test_py_d/ts_xmr_autosign.py

@@ -219,7 +219,8 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
 		return t
 
 	def autosign_start_thread(self):
-		self.asi.dev_disk_path.unlink(missing_ok=True)
+		if self.asi.dev_disk_path.exists():
+			self.asi.dev_disk_path.unlink()
 		def run():
 			t = self.spawn('mmgen-autosign', self.opts + ['wait'], direct_exec=True )
 			self.write_to_tmpfile('autosign_thread_pid',str(t.ep.pid))