mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-17 04:12:24 +02:00
refactor(routes): move task domain into routes/task/ subpackage
Slice 2p of the route-domain reorganization (#4082/#4071). Moves task_routes.py (1181 lines) into routes/task/, leaving a backward-compat sys.modules shim. Pure file reorganization, no behavior change. The shim uses sys.modules replacement so the `import ... as task_routes` + `monkeypatch.setattr(task_routes, "SessionLocal", ...)` / `"get_current_user"` pattern and the `task_routes.__file__` reads in test_auth_regressions.py all reach the canonical module. Four source-introspection test sites repointed: - test_aux_llm_owner_scope.py - test_model_helper_owner_scope.py - test_internal_api_base.py - test_webhook_trigger_auth_exempt.py Adds tests/test_task_routes_shim.py to pin the sys.modules shim contract. Verified: compileall clean; full suite 5040 passed, 3 skipped.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"""Regression test for the task route shim (slice 2p, #4082/#4071).
|
||||
|
||||
The backward-compat shim at ``routes/task_routes.py`` uses ``sys.modules``
|
||||
replacement so the legacy import path and the canonical ``routes.task.*``
|
||||
path resolve to the *same* module object. This is required because multiple
|
||||
tests do ``import routes.task_routes as task_routes`` followed by
|
||||
``monkeypatch.setattr(task_routes, "SessionLocal", ...)`` /
|
||||
``"get_current_user"``, and test_auth_regressions.py reads
|
||||
``task_routes.__file__`` for source introspection.
|
||||
"""
|
||||
|
||||
import importlib
|
||||
|
||||
import routes.task_routes as _shim_task # noqa: F401
|
||||
|
||||
|
||||
def test_legacy_and_canonical_task_module_are_same_object():
|
||||
legacy = importlib.import_module("routes.task_routes")
|
||||
canonical = importlib.import_module("routes.task.task_routes")
|
||||
assert legacy is canonical
|
||||
Reference in New Issue
Block a user