Browse Source

test suite: minor cleanups (async_run)

The MMGen Project 2 months ago
parent
commit
4749fe660b
4 changed files with 9 additions and 10 deletions
  1. 1 1
      test/cmdtest.py
  2. 3 3
      test/cmdtest_d/main.py
  3. 3 4
      test/cmdtest_d/xmr_autosign.py
  4. 2 2
      test/cmdtest_d/xmrwallet.py

+ 1 - 1
test/cmdtest.py

@@ -343,7 +343,7 @@ if __name__ == '__main__':
 		if hasattr(tr, 'tg'):
 		if hasattr(tr, 'tg'):
 			del tr.tg
 			del tr.tg
 		del tr
 		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'):
 		if os.getenv('MMGEN_EXEC_WRAPPER') or not os.getenv('MMGEN_IGNORE_TEST_PY_EXCEPTION'):
 			raise
 			raise
 		die(1, red('Test script exited with error'))
 		die(1, red('Test script exited with error'))

+ 3 - 3
test/cmdtest_d/main.py

@@ -20,9 +20,9 @@
 test.cmdtest_d.main: Basic operations tests for the cmdtest.py test suite
 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.color import green, cyan, gray
 from mmgen.fileutil import get_data_from_file, write_data_to_file
 from mmgen.fileutil import get_data_from_file, write_data_to_file
 from mmgen.wallet import get_wallet_cls
 from mmgen.wallet import get_wallet_cls
@@ -388,7 +388,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared):
 	@property
 	@property
 	def lbl_id(self):
 	def lbl_id(self):
 		if not hasattr(self, '_lbl_id'):
 		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]
 			self._lbl_id = ('account', 'label')['label_api' in rpc.caps]
 		return self._lbl_id
 		return self._lbl_id
 
 

+ 3 - 4
test/cmdtest_d/xmr_autosign.py

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

+ 2 - 2
test/cmdtest_d/xmrwallet.py

@@ -24,7 +24,7 @@ import sys, os, time, re, atexit, asyncio, shutil
 from subprocess import run, PIPE
 from subprocess import run, PIPE
 from collections import namedtuple
 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.obj import MMGenRange
 from mmgen.amt import XMRAmt
 from mmgen.amt import XMRAmt
 from mmgen.addrlist import ViewKeyAddrList, KeyAddrList, AddrIdxList
 from mmgen.addrlist import ViewKeyAddrList, KeyAddrList, AddrIdxList
@@ -51,7 +51,7 @@ def stop_daemons(self):
 		v.md.stop()
 		v.md.stop()
 
 
 def stop_miner_wallet_daemon(self):
 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):
 class CmdTestXMRWallet(CmdTestBase):
 	"""
 	"""