mirror of
https://github.com/d3vyce/fastapi-toolsets.git
synced 2026-08-04 23:54:09 +00:00
35 lines
805 B
Python
35 lines
805 B
Python
"""Fixture system for seeding databases with dependency resolution."""
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .enum import Context, LoadStrategy
|
|
|
|
if TYPE_CHECKING:
|
|
from .registry import FixtureRegistry
|
|
from .utils import load_fixtures, load_fixtures_by_context
|
|
|
|
__all__ = [
|
|
"Context",
|
|
"FixtureRegistry",
|
|
"LoadStrategy",
|
|
"load_fixtures",
|
|
"load_fixtures_by_context",
|
|
]
|
|
|
|
_LAZY = {
|
|
"FixtureRegistry": ".registry",
|
|
"load_fixtures": ".utils",
|
|
"load_fixtures_by_context": ".utils",
|
|
}
|
|
|
|
|
|
def __getattr__(name: str):
|
|
module_name = _LAZY.get(name)
|
|
if module_name is None:
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
|
|
import importlib
|
|
|
|
module = importlib.import_module(module_name, __name__)
|
|
return getattr(module, name)
|