Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fastapi_cachex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from .dependencies import CacheBackend as CacheBackend
from .dependencies import get_app_cache as get_app_cache
from .dependencies import get_cache_backend as get_cache_backend
from .exceptions import BackendNotFoundError as BackendNotFoundError
from .exceptions import CacheXError as CacheXError
from .exceptions import LockTimeoutError as LockTimeoutError
from .exceptions import RequestNotFoundError as RequestNotFoundError
from .lock import CacheLock as CacheLock
from .manager import CacheManager as CacheManager
from .manager_proxy import CacheManagerProxy as CacheManagerProxy
Expand Down Expand Up @@ -68,15 +71,18 @@ def _read_version() -> str:

__all__ = [
"AppCache",
"BackendNotFoundError",
"BackendProxy",
"CacheBackend",
"CacheKeyBuilder",
"CacheLock",
"CacheManager",
"CacheManagerProxy",
"CacheXError",
"FastAPICacheXSessionMiddleware",
"InvalidStateError",
"LockTimeoutError",
"RequestNotFoundError",
"Session",
"SessionConfig",
"SessionError",
Expand Down
14 changes: 14 additions & 0 deletions tests/test_exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Exceptions raised by the core are importable from the package (#160)."""

import pytest

import fastapi_cachex
from fastapi_cachex import exceptions


@pytest.mark.parametrize(
"name", ["BackendNotFoundError", "CacheXError", "RequestNotFoundError"]
)
def test_core_exception_is_exported(name: str) -> None:
assert name in fastapi_cachex.__all__
assert getattr(fastapi_cachex, name) is getattr(exceptions, name)
Loading