minor testing fixes

This commit is contained in:
The MMGen Project 2023-06-13 18:32:20 +00:00
commit 29ebec09c3
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 16 additions and 12 deletions

View file

@ -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")

View file

@ -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))

View file

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

View file

@ -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

View file

@ -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

View file

@ -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))