Skip to content

Commit

Permalink
test.unit: Prevent bare except ruff errors
Browse files Browse the repository at this point in the history
Allows ruff to pass in the repo with no problem. Since these are unit
tests, no investment is made to change behavior of the exception
handler.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Sep 30, 2024
1 parent 6446352 commit 3f98609
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests.unit/database/test_instanced_fv_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pathlib import Path

import pytest
from common import Tree, empty_tree # noqa: F401
from common import Tree
from edk2toollib.database import Edk2DB, Fv
from edk2toollib.database.tables import InstancedFvTable, InstancedInfTable
from edk2toollib.uefi.edk2.path_utilities import Edk2Path
Expand Down
22 changes: 11 additions & 11 deletions tests.unit/parsers/test_dmar_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_dmar_parser_dse_01h(self):
try:
dse_01_str = str(DmarParserTest.dse_t_01h)
self.assertNotEqual(dse_01_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert Device Scope Entry type 0 object to string")

def test_dmar_parser_dse_03h(self):
Expand All @@ -53,7 +53,7 @@ def test_dmar_parser_dse_03h(self):
try:
dse_03_str = str(DmarParserTest.dse_t_03h)
self.assertNotEqual(dse_03_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert Device Scope Entry type 3 object to string")

def test_dmar_parser_dse_04h(self):
Expand All @@ -72,7 +72,7 @@ def test_dmar_parser_dse_04h(self):
try:
dse_04_str = str(DmarParserTest.dse_t_04h)
self.assertNotEqual(dse_04_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert Device Scope Entry type 4 object to string")

def test_dmar_parser_drhd(self):
Expand Down Expand Up @@ -111,13 +111,13 @@ def test_dmar_parser_drhd(self):
try:
drhd_xml = DmarParserTest.drhd_t.toXml()
self.assertNotEqual(drhd_xml, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert DRHD object to xml")

try:
drhd_str = str(DmarParserTest.drhd_t)
self.assertNotEqual(drhd_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert DRHD object to string")

def test_dmar_parser_rmrr(self):
Expand Down Expand Up @@ -164,13 +164,13 @@ def test_dmar_parser_rmrr(self):
try:
rmrr_xml = DmarParserTest.rmrr_t.toXml()
self.assertNotEqual(rmrr_xml, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert RMRR object to xml")

try:
rmrr_str = str(DmarParserTest.rmrr_t)
self.assertNotEqual(rmrr_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert RMRR object to string")

def test_dmar_parser_acpi_header(self):
Expand Down Expand Up @@ -246,13 +246,13 @@ def test_dmar_parser_acpi_header(self):
try:
dmar_xml = acpi_header.toXml()
self.assertNotEqual(dmar_xml, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert ACPI header object to xml")

try:
dmar_str = str(acpi_header)
self.assertNotEqual(dmar_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert ACPI header object to string")

def test_dmar_parser_ivrs_full(self):
Expand Down Expand Up @@ -408,13 +408,13 @@ def test_dmar_parser_ivrs_full(self):
try:
dmar_xml = dmar_table.toXml()
self.assertNotEqual(dmar_xml, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert DMAR object to xml")

try:
dmar_str = str(dmar_table)
self.assertNotEqual(dmar_str, None)
except:
except Exception:
self.assertFalse(False, "Failed to convert DMAR object to string")


Expand Down

0 comments on commit 3f98609

Please sign in to comment.