diff --git a/arkindex/project/tests/__init__.py b/arkindex/project/tests/__init__.py
index 9db13cd9877d602b76806f3582bbe14103924a1f..ecceb69a5ef089ebd49976c3e8a964f63ba7f851 100644
--- a/arkindex/project/tests/__init__.py
+++ b/arkindex/project/tests/__init__.py
@@ -67,7 +67,7 @@ class _AssertExactQueriesContext(CaptureQueriesContext):
         if not self.path.exists():
             try:
                 self.path.write_text(actual_sql)
-            except IOError as e:
+            except OSError as e:
                 raise AssertionError(
                     f"Could not assert on SQL queries; the file at {self.path} did not exist. "
                     "A new file could not be created with the current SQL queries."
diff --git a/ruff.toml b/ruff.toml
index 3de53043e9b2ad54a5c6ce9219ced1f982e3bdce..8b77a6a2a6b0fc6f0a30426078213d5a6601e6f4 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -33,6 +33,8 @@ select = [
     "UP014",
     # redundant-open-modes
     "UP015",
+    # os-error-alias
+    "UP024",
 ]
 ignore = ["E501", "RET502", "RET503"]