mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-01 19:18:35 -04:00
483c42bb12
Slice 2i of the route-domain reorganization (#4082/#4071). Moves compare_routes.py into routes/compare/, leaving a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change. The shim uses sys.modules replacement so the `import ... as cr` + `monkeypatch.setattr(cr, "SessionLocal", ...)` / `"_owned_endpoint_by_url"` / `"_owned_endpoint_by_id"` pattern in test_endpoint_owner_scope_followup.py reaches the canonical module. Canonical module imports only from core/, src/, and routes.session_routes (zero dependency on the legacy shim). One source-introspection test site repointed: test_endpoint_owner_scope_followup.py (shared with other domains; only the compare entry repointed here). Adds tests/test_compare_routes_shim.py to pin the sys.modules shim contract. Verified: compileall clean; targeted tests pass.
19 lines
813 B
Python
19 lines
813 B
Python
"""Backward-compat shim — canonical location is routes/compare/compare_routes.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.compare_routes``, ``from routes.compare_routes import X``,
|
|
``importlib.import_module("routes.compare_routes")``, and the
|
|
``import ... as cr`` + ``monkeypatch.setattr(cr, "SessionLocal", ...)`` /
|
|
``"_owned_endpoint_by_url"`` / ``"_owned_endpoint_by_id"`` pattern used by
|
|
test_endpoint_owner_scope_followup.py all operate on the *same* object the
|
|
application actually uses. Keeps existing import paths working after
|
|
slice 2i (#4082/#4071). Source-introspection tests read the canonical file
|
|
by path.
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.compare import compare_routes as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|