diff --git a/litestar/contrib/sqlalchemy/__init__.py b/litestar/contrib/sqlalchemy/__init__.py index 5ecc157758..391161ed01 100644 --- a/litestar/contrib/sqlalchemy/__init__.py +++ b/litestar/contrib/sqlalchemy/__init__.py @@ -29,6 +29,10 @@ def __getattr__(attr_name: str) -> object: ) value = globals()[attr_name] = getattr(exceptions, attr_name) + + else: # pragma: no cover + raise RuntimeError(f"Unhandled module attribute: {attr_name!r}") + warn_deprecation( deprecated_name=f"litestar.contrib.sqlalchemy.{attr_name}", version="2.12", diff --git a/litestar/contrib/sqlalchemy/repository/__init__.py b/litestar/contrib/sqlalchemy/repository/__init__.py index ccf4716e73..81d0aece41 100644 --- a/litestar/contrib/sqlalchemy/repository/__init__.py +++ b/litestar/contrib/sqlalchemy/repository/__init__.py @@ -30,6 +30,9 @@ def __getattr__(attr_name: str) -> object: wrap_sqlalchemy_exception, # type: ignore[import-not-found] # pyright: ignore[reportMissingImport] ) + else: # pragma: no cover + raise RuntimeError(f"Unhandled module attribute: {attr_name!r}") + value = globals()[attr_name] = locals()[attr_name] warn_deprecation( deprecated_name=f"litestar.contrib.sqlalchemy.repository.{attr_name}", diff --git a/pyproject.toml b/pyproject.toml index 9472ea9f16..d6200f5b3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -247,6 +247,7 @@ enable_error_code = [ "truthy-iterable", "unused-awaitable", "ignore-without-code", + "possibly-undefined", "redundant-self", ] python_version = "3.8"