minor fixes and cleanups

This commit is contained in:
The MMGen Project 2024-09-02 09:43:48 +00:00
commit 36814cc03c
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 14 additions and 10 deletions

View file

@ -502,7 +502,7 @@ class Autosign:
if not silent:
msg(f"Mounting '{self.mountpoint}'")
else:
die(1,f"Unable to mount device at '{self.mountpoint}'")
die(1,f'Unable to mount device {self.dev_label} at {self.mountpoint}')
for dirname in self.dirs:
check_or_create(dirname)

View file

@ -995,14 +995,14 @@ if __name__ == '__main__':
tr = CmdTestRunner(data_dir,trash_dir)
tr.run_tests(cmd_args)
tr.warn_skipped()
if tr.daemon_started:
stop_test_daemons(network_id)
if tr.daemon_started and not cfg.no_daemon_stop:
stop_test_daemons(network_id, remove_datadir=True)
if hasattr(tr, 'tg'):
del tr.tg
del tr
except KeyboardInterrupt:
if tr.daemon_started:
stop_test_daemons(network_id)
if tr.daemon_started and not cfg.no_daemon_stop:
stop_test_daemons(network_id, remove_datadir=True)
tr.warn_skipped()
die(1,yellow('\ntest.py exiting at user request'))
except TestSuiteSpawnedScriptException as e:

View file

@ -149,7 +149,9 @@ class CmdTestAutosignBase(CmdTestBase):
def _macOS_mount_fs_image(self, loc):
time.sleep(0.2)
run(f'hdiutil attach -mountpoint {loc.mountpoint} {loc.fs_image_path}.dmg'.split(), stdout=DEVNULL, check=True)
run(
['hdiutil', 'attach', '-mountpoint', str(loc.mountpoint), f'{loc.fs_image_path}.dmg'],
stdout=DEVNULL, check=True)
def _macOS_eject_disk(self, label):
try:
@ -348,6 +350,7 @@ class CmdTestAutosignClean(CmdTestAutosignBase):
self.spawn('', msg_only=True)
self.insert_device()
silence()
self.do_mount()
end_silence()
@ -358,7 +361,9 @@ class CmdTestAutosignClean(CmdTestAutosignBase):
t = self.spawn('mmgen-autosign', [f'--coins={coins}','clean'], no_msg=True)
out = t.read()
self.insert_device()
if sys.platform == 'darwin':
self.insert_device()
silence()
self.do_mount()
end_silence()
@ -436,8 +441,7 @@ class CmdTestAutosignThreaded(CmdTestAutosignBase):
def _wait_signed(self,desc):
oqmsg_r(gray(f'→ offline wallet{"s" if desc.endswith("s") else ""} waiting for {desc}'))
assert not self.asi.device_inserted, (
f'{getattr(self.asi, "dev_label_path", self.asi.dev_label)}’ is inserted!')
assert not self.asi.device_inserted, f'{self.asi.dev_label}’ is inserted!'
assert not self.asi.mountpoint.is_mount(), f'{self.asi.mountpoint}’ is mounted!'
self.insert_device()
while True:

View file

@ -420,7 +420,7 @@ class VirtBlockDeviceLinux(VirtBlockDeviceBase):
do_run(['sudo', '/sbin/losetup', dev, str(path)])
def do_detach(self, dev, check=True):
do_run(['/sbin/losetup', '-d', dev], check=check)
do_run(['sudo', '/sbin/losetup', '-d', dev], check=check)
class VirtBlockDeviceMacOS(VirtBlockDeviceBase):