1313 timedelta ,
1414)
1515from pathlib import Path
16+ from typing import Any
1617
1718import pytest
1819from sqlalchemy import (
3334
3435import galaxy .model .migrations
3536
36- migrations_path = Path (galaxy .model .migrations .__file__ ).parent / "alembic" / "versions_gxy" / "724237cc4cf0_migrate_custos_to_psa_tokens.py"
37+ migrations_path = (
38+ Path (galaxy .model .migrations .__file__ ).parent
39+ / "alembic"
40+ / "versions_gxy"
41+ / "724237cc4cf0_migrate_custos_to_psa_tokens.py"
42+ )
3743spec = importlib .util .spec_from_file_location ("migration_module" , migrations_path )
44+ assert spec is not None , f"Could not load spec from { migrations_path } "
45+ assert spec .loader is not None , f"Spec has no loader for { migrations_path } "
3846migration_module = importlib .util .module_from_spec (spec )
3947spec .loader .exec_module (migration_module )
4048migrate_custos_tokens_to_psa = migration_module .migrate_custos_tokens_to_psa
4149
4250# Create test tables
43- Base = declarative_base ()
51+ _Base : Any = declarative_base ()
4452
4553
46- class CustosAuthnzTokenTest (Base ):
54+ class CustosAuthnzTokenTest (_Base ):
4755 """Test model for custos_authnz_token table."""
4856
4957 __tablename__ = "custos_authnz_token"
@@ -59,7 +67,7 @@ class CustosAuthnzTokenTest(Base):
5967 refresh_expiration_time = Column (DateTime )
6068
6169
62- class UserAuthnzTokenTest (Base ):
70+ class UserAuthnzTokenTest (_Base ):
6371 """Test model for oidc_user_authnz_tokens table."""
6472
6573 __tablename__ = "oidc_user_authnz_tokens"
@@ -77,7 +85,7 @@ class UserAuthnzTokenTest(Base):
7785def db_session ():
7886 """Create an in-memory SQLite database for testing."""
7987 engine = create_engine ("sqlite:///:memory:" )
80- Base .metadata .create_all (engine )
88+ _Base .metadata .create_all (engine )
8189 Session = sessionmaker (bind = engine )
8290 session = Session ()
8391 yield session
0 commit comments