[elbe-devel] [PATCH 31/37] flake8: Do not use bare except, specify exception instead (E722)
Benedikt Spranger
b.spranger at linutronix.de
Wed Feb 7 15:28:58 CET 2024
Target all flake8 E722 warnings.
Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
elbepack/commands/check-build.py | 2 +-
elbepack/repodir.py | 2 +-
elbepack/tests/test_xml.py | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/elbepack/commands/check-build.py b/elbepack/commands/check-build.py
index 9d6e6275..7ec82df5 100644
--- a/elbepack/commands/check-build.py
+++ b/elbepack/commands/check-build.py
@@ -81,7 +81,7 @@ class CheckBase:
except CheckException as E:
logging.exception(E)
self.ret = 1
- except:
+ except Exception:
logging.error(traceback.format_exc())
self.ret = 1
return self.ret
diff --git a/elbepack/repodir.py b/elbepack/repodir.py
index aed240dd..2cdda4d0 100644
--- a/elbepack/repodir.py
+++ b/elbepack/repodir.py
@@ -51,7 +51,7 @@ def preprocess_repodir(xml, xmldir):
keyfile = os.path.join(hostdir, repodir.attrib['signed-by'])
auth_el = Element("raw-key")
auth_el.text = "\n" + open(keyfile, encoding='ascii').read()
- except:
+ except Exception:
raise RepodirError(
f"{keyfile} is not a valid ascii-armored OpenPGP keyring")
else:
diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index fb271043..4377d97c 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -46,8 +46,8 @@ class TestSimpleXML(ElbeTestCase):
with self.subTest(f'check build {cmd}'):
system(f'{sys.executable} {elbe_exe} check-build {cmd} "{build_dir}"')
- except:
- raise
+ except Exception as e:
+ raise e
else:
# This is a tear down of the project, it's okay if it fails
system(
@@ -80,8 +80,8 @@ class TestPbuilder(ElbeTestCase):
uuid = f.read()
system(f'cd "{build_dir}/libgpio"; \
{sys.executable} {elbe_exe} pbuilder build --project {uuid}')
- except:
- raise
+ except Exception as e:
+ raise e
else:
# This is a tearDown of the project, it's okay if it fails
system(
--
2.43.0
More information about the elbe-devel
mailing list