test suite: minor cleanups (async_run)

This commit is contained in:
The MMGen Project 2025-10-01 15:30:56 +00:00
commit 4749fe660b
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 9 additions and 10 deletions

View file

@ -343,7 +343,7 @@ if __name__ == '__main__':
if hasattr(tr, 'tg'):
del tr.tg
del tr
# if cmdtest.py itself is running under exec_wrapper, re-raise so exec_wrapper can handle exception:
# if cmdtest.py itself is running under exec_wrapper, re-raise so wrapper can handle exception:
if os.getenv('MMGEN_EXEC_WRAPPER') or not os.getenv('MMGEN_IGNORE_TEST_PY_EXCEPTION'):
raise
die(1, red('Test script exited with error'))

View file

@ -20,9 +20,9 @@
test.cmdtest_d.main: Basic operations tests for the cmdtest.py test suite
"""
import sys, os
import sys, os, asyncio
from mmgen.util import msg, msg_r, async_run, capfirst, get_extension, die
from mmgen.util import msg, msg_r, capfirst, get_extension, die
from mmgen.color import green, cyan, gray
from mmgen.fileutil import get_data_from_file, write_data_to_file
from mmgen.wallet import get_wallet_cls
@ -388,7 +388,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared):
@property
def lbl_id(self):
if not hasattr(self, '_lbl_id'):
rpc = async_run(rpc_init(self.cfg, self.proto))
rpc = asyncio.run(rpc_init(self.cfg, self.proto))
self._lbl_id = ('account', 'label')['label_api' in rpc.caps]
return self._lbl_id

View file

@ -13,10 +13,9 @@
test.cmdtest_d.xmr_autosign: xmr autosigning tests for the cmdtest.py test suite
"""
import re
import re, asyncio
from mmgen.color import blue, cyan, brown
from mmgen.util import async_run
from ..include.common import imsg, silence, end_silence
from .include.common import get_file_with_ext
@ -139,8 +138,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
kal.file.write(ask_overwrite=False)
fn = get_file_with_ext(data.udir, 'akeys')
m = op('create', self.alice_cfg, fn, '1-2')
async_run(m.main())
async_run(m.stop_wallet_daemon())
asyncio.run(m.main())
asyncio.run(m.stop_wallet_daemon())
end_silence()
return 'ok'

View file

@ -24,7 +24,7 @@ import sys, os, time, re, atexit, asyncio, shutil
from subprocess import run, PIPE
from collections import namedtuple
from mmgen.util import async_run, capfirst, is_int, die, list_gen
from mmgen.util import capfirst, is_int, die, list_gen
from mmgen.obj import MMGenRange
from mmgen.amt import XMRAmt
from mmgen.addrlist import ViewKeyAddrList, KeyAddrList, AddrIdxList
@ -51,7 +51,7 @@ def stop_daemons(self):
v.md.stop()
def stop_miner_wallet_daemon(self):
async_run(self.users['miner'].wd_rpc.stop_daemon())
asyncio.run(self.users['miner'].wd_rpc.stop_daemon())
class CmdTestXMRWallet(CmdTestBase):
"""