2025-10-19 21:35:02 -04:00
|
|
|
"""Pytest configuration for automatic typeguard integration."""
|
|
|
|
|
|
2025-10-30 12:22:11 -04:00
|
|
|
from typing import Any
|
|
|
|
|
|
2025-10-23 12:58:32 -04:00
|
|
|
from typeguard import install_import_hook
|
2025-10-19 21:35:02 -04:00
|
|
|
|
2025-10-23 12:58:32 -04:00
|
|
|
|
2025-10-30 12:22:11 -04:00
|
|
|
def pytest_configure(config: Any) -> None: # noqa: ARG001
|
2025-10-19 21:35:02 -04:00
|
|
|
"""Configure pytest to use typeguard automatically."""
|
2025-10-23 12:58:32 -04:00
|
|
|
# Install typeguard import hook to automatically check all functions
|
|
|
|
|
# with type hints in the backend package during test runs
|
|
|
|
|
install_import_hook("backend")
|
|
|
|
|
|
|
|
|
|
# Also check any other packages in src/
|
|
|
|
|
install_import_hook("src")
|
|
|
|
|
|
|
|
|
|
print("🛡️ Automatic typeguard hooks installed for test run")
|
2025-10-19 21:35:02 -04:00
|
|
|
|
|
|
|
|
|
2025-10-30 12:22:11 -04:00
|
|
|
def pytest_runtest_setup(item: Any) -> None:
|
2025-10-19 21:35:02 -04:00
|
|
|
"""Set up typeguard for each test run."""
|
2025-10-23 12:58:32 -04:00
|
|
|
# The import hook is automatically enabled via pytest_configure
|
|
|
|
|
# All functions with type hints will be automatically checked
|
2025-10-19 21:35:02 -04:00
|
|
|
pass
|