Browse Source

minor whitespace, cleanups

The MMGen Project 2 weeks ago
parent
commit
4a24d2153c
5 changed files with 28 additions and 19 deletions
  1. 12 3
      mmgen/cfg.py
  2. 3 3
      mmgen/opts.py
  3. 2 1
      mmgen/tw/store.py
  4. 6 5
      test/cmdtest_d/xmr_autosign.py
  5. 5 7
      test/cmdtest_d/xmrwallet.py

+ 12 - 3
mmgen/cfg.py

@@ -438,7 +438,7 @@ class Config(Lockable):
 	@property
 	def data_dir(self):
 		"""
-		location of wallet and other data - same as data_dir_root for mainnet
+		location of wallet and other data
 		"""
 		if not hasattr(self, '_data_dir'):
 			def make_path():
@@ -554,10 +554,19 @@ class Config(Lockable):
 		self.coin = self.coin.upper()
 		self.token = self.token.upper() if self.token else None
 
-		if self.regtest or self.bob or self.alice or self.carol or gc.prog_name == f'{gc.proj_id}-regtest':
+		if (
+				self.regtest or
+				self.bob or
+				self.alice or
+				self.carol or
+				gc.prog_name == f'{gc.proj_id}-regtest'):
 			if self.coin != 'XMR':
 				self.network = 'regtest'
-			self.test_user = 'bob' if self.bob else 'alice' if self.alice else 'carol' if self.carol else ''
+			self.test_user = (
+				'bob' if self.bob else
+				'alice' if self.alice else
+				'carol' if self.carol else
+				'')
 		else:
 			self.network = 'testnet' if self.testnet else 'mainnet'
 

+ 3 - 3
mmgen/opts.py

@@ -317,9 +317,9 @@ class UserOpts(Opts):
 			-- --skip-cfg-file        Skip reading the configuration file
 			-- --version              Print version information and exit
 			-- --usage                Print usage information and exit
-			b- --bob                  Specify user ‘Bob’ in MMGen regtest mode
-			b- --alice                Specify user ‘Alice’ in MMGen regtest mode
-			b- --carol                Specify user ‘Carol’ in MMGen regtest mode
+			x- --bob                  Specify user ‘Bob’ in MMGen regtest or test mode
+			x- --alice                Specify user ‘Alice’ in MMGen regtest or test mode
+			x- --carol                Specify user ‘Carol’ in MMGen regtest or test mode
 			rr COIN-SPECIFIC OPTIONS:
 			rr   For descriptions, refer to the non-prefixed versions of these options above
 			rr   Prefixed options override their non-prefixed counterparts

+ 2 - 1
mmgen/tw/store.py

@@ -86,7 +86,8 @@ class TwCtlWithStore(TwCtl, metaclass=AsyncInit):
 			cfg.data_dir_root,
 			'altcoins',
 			proto.coin.lower(),
-			('' if proto.network == 'mainnet' else proto.network)) / (cls.tw_subdir or '')
+			('' if proto.network == 'mainnet' else proto.network),
+			(cls.tw_subdir or ''))
 
 	def upgrade_wallet_maybe(self):
 		pass

+ 6 - 5
test/cmdtest_d/xmr_autosign.py

@@ -39,11 +39,10 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
 
 	# xmrwallet attrs:
 	tx_relay_user = 'miner'
-	#    user     sid      autosign  shift kal_range add_coind_args
+	# user sid autosign port_shift kal_range add_coind_args
 	user_data = (
 		('miner', '98831F3A', False, 130, '1', []),
-		('alice', 'FE3C6545', True,  150, '1-2', []),
-	)
+		('alice', 'FE3C6545', True,  150, '1-2', []))
 
 	# autosign attrs:
 	coins = ['xmr']
@@ -179,7 +178,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
 		t = self.spawn(
 			'mmgen-xmrwallet',
 			self.extra_opts
-			+ [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}']
+			+ [f'--wallet-dir={data.udir}']
+			+ [f'--daemon=localhost:{data.md.rpc_port}']
 			+ (self.autosign_opts if autosign else [])
 			+ ['dump']
 			+ ([] if autosign else [get_file_with_ext(data.udir, 'akeys')]))
@@ -312,7 +312,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
 		args = (
 			self.extra_opts
 			+ self.autosign_opts
-			+ [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}']
+			+ [f'--wallet-dir={data.udir}']
+			+ [f'--daemon=localhost:{data.md.rpc_port}']
 			+ add_opts
 			+ [op]
 			+ ([get_file_with_ext(self.asi.xmr_tx_dir, ext)] if ext else [])

+ 5 - 7
test/cmdtest_d/xmrwallet.py

@@ -293,8 +293,8 @@ class CmdTestXMRWallet(CmdTestBase):
 			run(f'rm -f {glob}', shell=True)
 		t = self.spawn(
 			'mmgen-xmrwallet',
-			[f'--wallet-dir={data.udir}']
-			+ self.extra_opts
+			self.extra_opts
+			+ [f'--wallet-dir={data.udir}']
 			+ (self.autosign_opts if data.autosign else [])
 			+ add_opts
 			+ [op]
@@ -412,13 +412,11 @@ class CmdTestXMRWallet(CmdTestBase):
 		data = self.users[user]
 		if data.autosign:
 			self.insert_device_online()
-		cmd_opts = list_gen(
-			[f'--wallet-dir={data.udir}'],
-			[f'--daemon=localhost:{data.md.rpc_port}'])
 		t = self.spawn(
 			'mmgen-xmrwallet',
 			self.extra_opts
-			+ cmd_opts
+			+ [f'--wallet-dir={data.udir}']
+			+ [f'--daemon=localhost:{data.md.rpc_port}']
 			+ (self.autosign_opts if data.autosign else [])
 			+ add_opts
 			+ [op]
@@ -459,7 +457,6 @@ class CmdTestXMRWallet(CmdTestBase):
 
 		data = self.users[user]
 		cmd_opts = list_gen(
-			[f'--wallet-dir={data.udir}'],
 			[f'--outdir={data.udir}', not data.autosign],
 			[f'--daemon=localhost:{data.md.rpc_port}'],
 			[f'--tx-relay-daemon={tx_relay_parm}', tx_relay_parm],
@@ -469,6 +466,7 @@ class CmdTestXMRWallet(CmdTestBase):
 		t = self.spawn(
 			'mmgen-xmrwallet',
 			self.extra_opts
+			+ [f'--wallet-dir={data.udir}']
 			+ cmd_opts
 			+ add_opts
 			+ (self.autosign_opts if data.autosign else [])