From 29ebec09c3228c7b177ed15a47cd845a4d653c77 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 13 Jun 2023 18:32:20 +0000 Subject: [PATCH] minor testing fixes --- mmgen/autosign.py | 3 ++- test/misc/input_func.py | 8 ++++---- test/test-release.sh | 2 ++ test/test.py | 5 ----- test/test_py_d/ts_input.py | 7 ++++++- test/test_py_d/ts_xmr_autosign.py | 3 ++- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mmgen/autosign.py b/mmgen/autosign.py index fd70dc35..74892567 100755 --- a/mmgen/autosign.py +++ b/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") diff --git a/test/misc/input_func.py b/test/misc/input_func.py index 28ce1c8e..7acb4e16 100755 --- a/test/misc/input_func.py +++ b/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)) diff --git a/test/test-release.sh b/test/test-release.sh index a4c790da..ebb4aee2 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -278,6 +278,8 @@ remove_skipped_tests check_tests +test/test.py clean + start_time=$(date +%s) run_tests "$tests" diff --git a/test/test.py b/test/test.py index 11f0e108..950701be 100755 --- a/test/test.py +++ b/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 diff --git a/test/test_py_d/ts_input.py b/test/test_py_d/ts_input.py index 5b413c4c..2dead78b 100755 --- a/test/test_py_d/ts_input.py +++ b/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 diff --git a/test/test_py_d/ts_xmr_autosign.py b/test/test_py_d/ts_xmr_autosign.py index 2de9d61c..40b9c835 100755 --- a/test/test_py_d/ts_xmr_autosign.py +++ b/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))