mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-01 19:18:35 -04:00
b7d3f2a28d
Slice 2g of the route-domain reorganization (#4082/#4071). Moves
cleanup_routes.py into routes/cleanup/, leaving a backward-compat
sys.modules shim at the old path. Pure file reorganization, no behavior
change.
The shim uses sys.modules replacement so string-targeted
monkeypatch.setattr("routes.cleanup_routes.*", ...) in
test_cleanup_owner_scope.py reaches the canonical module.
Canonical module imports only from src/ and stdlib (zero internal
routes/ coupling). Zero source-introspection landmines.
Adds tests/test_cleanup_routes_shim.py to pin the sys.modules shim
contract. Verified: compileall clean; targeted tests pass.
18 lines
795 B
Python
18 lines
795 B
Python
"""Backward-compat shim — canonical location is routes/cleanup/cleanup_routes.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.cleanup_routes``, ``from routes.cleanup_routes import X``,
|
|
``importlib.import_module("routes.cleanup_routes")``, and the string-targeted
|
|
``monkeypatch.setattr("routes.cleanup_routes.get_cleanup_preview", ...)`` /
|
|
``"routes.cleanup_routes.get_current_user"`` / ``"routes.cleanup_routes.
|
|
cleanup_sessions"`` pattern used by test_cleanup_owner_scope.py all operate
|
|
on the *same* object the application actually uses. Keeps existing import
|
|
paths working after slice 2g (#4082/#4071).
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.cleanup import cleanup_routes as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|