mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-15 17:18:38 +00:00
Wiring moves out of deps.py::langgraph_runtime into app/composition.py::build_domain_services, so the rule the assembly owns -- a memory database backend yields no services and the routes answer 503 -- is an assertion in tests/test_composition.py instead of a comment inside the lifespan.
24 lines
890 B
Python
24 lines
890 B
Python
"""Composition-root tests -- the rules the wiring itself owns.
|
|
|
|
``build_domain_services`` was extracted into a pure function precisely so
|
|
these rules are assertions instead of a comment inside the lifespan:
|
|
a ``database.backend: memory`` deployment gets no services (the dependency
|
|
providers translate that into 503).
|
|
"""
|
|
|
|
from app.composition import build_domain_services
|
|
|
|
|
|
class TestMemoryBackend:
|
|
def test_no_sql_backend_means_no_services(self):
|
|
services = build_domain_services(session_factory=None, run_store=object())
|
|
assert services.feedback is None
|
|
|
|
|
|
class TestSqlBackend:
|
|
def test_services_are_assembled(self):
|
|
# A bare object suffices: the factory is only handed to adapters,
|
|
# never called during assembly.
|
|
services = build_domain_services(session_factory=object(), run_store=object())
|
|
assert services.feedback is not None
|