from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path MIGRATION_PATH = Path(__file__).parents[1] / "alembic" / "versions" / "0023_detail_concierge_advisor.py" SPEC = spec_from_file_location("detail_concierge_migration", MIGRATION_PATH) assert SPEC and SPEC.loader MIGRATION = module_from_spec(SPEC) SPEC.loader.exec_module(MIGRATION) def test_concierge_advisor_column_is_added_only_when_missing(): assert MIGRATION.should_add_concierge_advisor_column(set()) assert not MIGRATION.should_add_concierge_advisor_column({"id", "conciergeAdvisorId"})