mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-06 06:52:20 +02:00
routes/email_routes.py (7,194 lines), routes/email_helpers.py (2,025) and routes/email_pollers.py (1,764) were the largest flat email area left in routes/. They now live in routes/email/, following the pattern fifteen route areas already use: the canonical module under the package, a shim at the old path that replaces itself in sys.modules with the canonical object. The shim matters more here than the move. Dozens of email tests monkeypatch module attributes, and several pop the module from sys.modules and re-import it. Without identity between routes.email_routes and routes.email.email_routes those patches would apply to a different object than the app uses. Intra-package imports keep the flat path, matching routes/document/ and routes/gallery/: the shim resolves them and the diff stays a move. Eight path references in five test modules read these files as source rather than importing them, so they now read the canonical location. That is the same adjustment every previous conversion made, and it is why the note/document shims mention source-introspection tests explicitly. No behaviour change. Verified with the full suite and under several explicit collection orders, since a byte-identical routes move has broken tests under one ordering before.
17 lines
664 B
Python
17 lines
664 B
Python
"""Backward-compat shim — canonical location is routes/email/email_helpers.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.email_helpers``, ``from routes.email_helpers import X``,
|
|
``importlib.import_module("routes.email_helpers")`` and the
|
|
``import ... as email_helpers`` + ``monkeypatch.setattr(email_helpers, ...)``
|
|
pattern used across the email tests all operate on the *same* object the
|
|
application actually uses. Source-introspection tests read the canonical file
|
|
by path.
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.email import email_helpers as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|