mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-05 02:45:28 +00:00
Slice 2m of the route-domain reorganization (#4082/#4071, per
specs/architecture-runtime-inventory.md §6.3). Moves document_routes.py
(1810 lines) and document_helpers.py (243 lines) into routes/document/,
leaving backward-compat sys.modules shims at the old paths. Pure file
reorganization, no behavior change.
Both shims use sys.modules replacement so the `import ... as droutes` +
`droutes.SessionLocal = ...` / `monkeypatch.setattr(droutes, ...)` pattern
in multiple tests, and the `sys.modules.pop("routes.document_helpers")` +
re-import pattern in test_security_regressions.py, all reach the canonical
modules.
The canonical document_routes.py imports helpers from the canonical path
(routes.document.document_helpers), not the legacy shim.
Three source-introspection test sites repointed to the new canonical path:
- test_imap_mailbox_quoting.py
- test_model_helper_owner_scope.py
- test_vision_owner_scope.py (shared with other domains; document entry repointed)
Adds tests/test_document_routes_shim.py to pin the sys.modules shim contract
for both modules.
Verified: compileall clean; full suite 4789 passed, 3 skipped.
17 lines
763 B
Python
17 lines
763 B
Python
"""Backward-compat shim — canonical location is routes/document/document_routes.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.document_routes``, ``from routes.document_routes import
|
|
X``, ``importlib.import_module("routes.document_routes")``, and the
|
|
``import ... as droutes`` + ``droutes.SessionLocal = ...`` /
|
|
``monkeypatch.setattr(droutes, ...)`` pattern used by multiple tests all
|
|
operate on the *same* object the application actually uses. Keeps existing
|
|
import paths working after slice 2m (#4082/#4071). Source-introspection tests
|
|
read the canonical file by path.
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.document import document_routes as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|