1313 timedelta ,
1414)
1515from pathlib import Path
16+ from typing import Any
1617
1718import pytest
1819from sqlalchemy import (
3536
3637migrations_path = Path (galaxy .model .migrations .__file__ ).parent / "alembic" / "versions_gxy" / "724237cc4cf0_migrate_custos_to_psa_tokens.py"
3738spec = importlib .util .spec_from_file_location ("migration_module" , migrations_path )
39+ assert spec is not None , f"Could not load spec from { migrations_path } "
40+ assert spec .loader is not None , f"Spec has no loader for { migrations_path } "
3841migration_module = importlib .util .module_from_spec (spec )
3942spec .loader .exec_module (migration_module )
4043migrate_custos_tokens_to_psa = migration_module .migrate_custos_tokens_to_psa
4144
4245# Create test tables
43- Base = declarative_base ()
46+ _Base : Any = declarative_base ()
4447
4548
46- class CustosAuthnzTokenTest (Base ):
49+ class CustosAuthnzTokenTest (_Base ):
4750 """Test model for custos_authnz_token table."""
4851
4952 __tablename__ = "custos_authnz_token"
@@ -59,7 +62,7 @@ class CustosAuthnzTokenTest(Base):
5962 refresh_expiration_time = Column (DateTime )
6063
6164
62- class UserAuthnzTokenTest (Base ):
65+ class UserAuthnzTokenTest (_Base ):
6366 """Test model for oidc_user_authnz_tokens table."""
6467
6568 __tablename__ = "oidc_user_authnz_tokens"
@@ -77,7 +80,7 @@ class UserAuthnzTokenTest(Base):
7780def db_session ():
7881 """Create an in-memory SQLite database for testing."""
7982 engine = create_engine ("sqlite:///:memory:" )
80- Base .metadata .create_all (engine )
83+ _Base .metadata .create_all (engine )
8184 Session = sessionmaker (bind = engine )
8285 session = Session ()
8386 yield session
0 commit comments