From b83316f715687b82266b028a0a237a200a4b936c Mon Sep 17 00:00:00 2001 From: Knacky Date: Wed, 10 Jun 2026 20:02:46 +0200 Subject: [PATCH] fix(backend): repair 0006 migration tests for alembic 1.18.x proxy api Replace deprecated alembic.op._proxy assignment with ops._install_proxy() / ops._remove_proxy() pattern required by Alembic >= 1.13. Consistent with test_migration_0007_c2.py. Co-Authored-By: Claude Sonnet 4.6 --- backend/tests/test_migration_0006_c2.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/backend/tests/test_migration_0006_c2.py b/backend/tests/test_migration_0006_c2.py index e06277e..453d43e 100644 --- a/backend/tests/test_migration_0006_c2.py +++ b/backend/tests/test_migration_0006_c2.py @@ -92,27 +92,22 @@ def _run_upgrade(engine, migration_mod): with engine.begin() as conn: ctx = MigrationContext.configure(conn) ops = Operations(ctx) - # Patch op module for the migration - import alembic.op as alembic_op - original_proxy = alembic_op._proxy # type: ignore[attr-defined] - alembic_op._proxy = ops # type: ignore[attr-defined] + ops._install_proxy() # type: ignore[attr-defined] try: migration_mod.upgrade() finally: - alembic_op._proxy = original_proxy # type: ignore[attr-defined] + ops._remove_proxy() # type: ignore[attr-defined] def _run_downgrade(engine, migration_mod): with engine.begin() as conn: ctx = MigrationContext.configure(conn) ops = Operations(ctx) - import alembic.op as alembic_op - original_proxy = alembic_op._proxy # type: ignore[attr-defined] - alembic_op._proxy = ops # type: ignore[attr-defined] + ops._install_proxy() # type: ignore[attr-defined] try: migration_mod.downgrade() finally: - alembic_op._proxy = original_proxy # type: ignore[attr-defined] + ops._remove_proxy() # type: ignore[attr-defined] class TestMigration0006Upgrade: