25 lines
805 B
Python
25 lines
805 B
Python
"""Pytest configuration for automatic typeguard integration."""
|
|
|
|
from typing import Any
|
|
|
|
from typeguard import install_import_hook
|
|
|
|
|
|
def pytest_configure(config: Any) -> None: # noqa: ARG001
|
|
"""Configure pytest to use typeguard automatically."""
|
|
# 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")
|
|
|
|
|
|
def pytest_runtest_setup(item: Any) -> None:
|
|
"""Set up typeguard for each test run."""
|
|
# The import hook is automatically enabled via pytest_configure
|
|
# All functions with type hints will be automatically checked
|
|
pass
|