From 4749fe660bd439a99f86812effff45199660b21e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 1 Oct 2025 15:30:56 +0000 Subject: [PATCH] test suite: minor cleanups (async_run) --- test/cmdtest.py | 2 +- test/cmdtest_d/main.py | 6 +++--- test/cmdtest_d/xmr_autosign.py | 7 +++---- test/cmdtest_d/xmrwallet.py | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test/cmdtest.py b/test/cmdtest.py index 14a42575..443ddecd 100755 --- a/test/cmdtest.py +++ b/test/cmdtest.py @@ -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')) diff --git a/test/cmdtest_d/main.py b/test/cmdtest_d/main.py index 91d8032b..54f0951f 100755 --- a/test/cmdtest_d/main.py +++ b/test/cmdtest_d/main.py @@ -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 diff --git a/test/cmdtest_d/xmr_autosign.py b/test/cmdtest_d/xmr_autosign.py index 0e73f00a..ca8ba36e 100755 --- a/test/cmdtest_d/xmr_autosign.py +++ b/test/cmdtest_d/xmr_autosign.py @@ -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' diff --git a/test/cmdtest_d/xmrwallet.py b/test/cmdtest_d/xmrwallet.py index 83bc94f2..d4fc9cab 100755 --- a/test/cmdtest_d/xmrwallet.py +++ b/test/cmdtest_d/xmrwallet.py @@ -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): """