From 7faa90cf40b4836ff65ff57f87c44cad76494651 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 26 Jul 2021 18:23:48 +0000 Subject: [PATCH] minor fixes, cleanups --- mmgen/daemon.py | 3 +++ mmgen/util.py | 3 +-- mmgen/xmrwallet.py | 3 +-- test/test_py_d/ts_ethdev.py | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mmgen/daemon.py b/mmgen/daemon.py index 01480065..1d7aef99 100755 --- a/mmgen/daemon.py +++ b/mmgen/daemon.py @@ -463,6 +463,8 @@ class CoinDaemon(Daemon): port_shift = None, datadir = None ): + self.test_suite = test_suite + super().__init__() self.shared_args = [] @@ -673,6 +675,7 @@ class EthereumDaemon(CoinDaemon): [f'--ports-shift={self.port_shift}'], [f'--base-path={chaindir}'], ['--config=dev'], + ['--mode=offline',self.test_suite], ['--log-file='+os.path.join(self.datadir,'openethereum.log')], ['daemon', ld], [self.pidfile, ld], diff --git a/mmgen/util.py b/mmgen/util.py index 2da880b6..04ebb090 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -21,6 +21,7 @@ util.py: Low-level routines imported by other modules in the MMGen suite """ import sys,os,time,stat,re +from subprocess import run from hashlib import sha256 from string import hexdigits,digits from .color import * @@ -236,7 +237,6 @@ def check_or_create_dir(path): os.listdir(path) except: if os.getenv('MMGEN_TEST_SUITE'): - from subprocess import run try: # exception handling required for MSWin/MSYS2 run(['/bin/rm','-rf',path]) except: @@ -813,7 +813,6 @@ def do_pager(text): for pager in pagers: try: - from subprocess import run m = text + ('' if pager == 'less' else end_msg) p = run([pager],input=m.encode(),check=True) msg_r('\r') diff --git a/mmgen/xmrwallet.py b/mmgen/xmrwallet.py index 8d72716d..a4e74c93 100755 --- a/mmgen/xmrwallet.py +++ b/mmgen/xmrwallet.py @@ -153,11 +153,10 @@ class MoneroMMGenTX: } }, cls = json_encoder, - indent = 4 # DEBUG ) fn = '{}{}-XMR[{!s}]{}.sigtx'.format( self.base_chksum.upper(), - ('-'+self.full_chksum.upper()) if self.full_chksum else '', + (lambda s: f'-{s.upper()}' if s else '')(self.full_chksum), self.data.amount, (lambda s: '' if s == 'mainnet' else f'.{s}')(self.data.network), ) diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index a0d11948..433abc4d 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -331,7 +331,8 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): from shutil import copytree for d in ('mm1','mm2'): copytree(os.path.join(srcdir,d),os.path.join(self.tmpdir,d)) - start_test_daemons(self.proto.coin,remove_datadir=True) + if not opt.no_daemon_autostart: + start_test_daemons(self.proto.coin,remove_datadir=True) return 'ok' def wallet_upgrade(self,src_file): @@ -993,5 +994,6 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared): def stop(self): self.spawn('',msg_only=True) - stop_test_daemons(self.proto.coin) + if not opt.no_daemon_stop: + stop_test_daemons(self.proto.coin) return 'ok'