Fix BaseException catch in test files

Replace bare except clauses with 'except Exception' to avoid
catching system-exiting exceptions like KeyboardInterrupt and
SystemExit, which should not be suppressed.

Fixes: GitHub CodeQL Alerts #15, #16, #17
Rule: py/catch-base-exception
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
This commit is contained in:
Bernd Schubert
2026-04-05 22:49:09 +02:00
parent 0d037dbe2b
commit efa6c4c8be
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -105,7 +105,7 @@ def test_notify1(tmpdir, name, notify, output_checker):
try:
umount(mount_process, mnt_dir)
logger.debug("Umount disabled")
except:
except Exception:
logger.error(f"Failure in unmount: '{' '.join(cmdline)}'")
cleanup(mount_process, mnt_dir)
logger.debug("Unmount completed")
@@ -148,7 +148,7 @@ def test_notify_file_size(tmpdir, notify, output_checker):
else:
try:
umount(mount_process, mnt_dir)
except:
except Exception:
logger.error(f"Failure in unmount: '{' '.join(cmdline)}'")
cleanup(mount_process, mnt_dir)
logger.debug("Unmount completed")
+1 -1
View File
@@ -250,7 +250,7 @@ os.environ['PATH'] = '%s:%s' % (pjoin(basename, 'example'), os.environ['PATH'])
try:
(fuse_proto, fuse_caps) = get_printcap()
except:
except Exception:
# Rely on test to raise error
fuse_proto = (0,0)
fuse_caps = set()