mypy init

This commit is contained in:
2026-10-10 17:46:16 +01:00
parent 3fab51fe70
commit 7038d8546b
3 changed files with 19 additions and 10 deletions
+2 -3
View File
@@ -65,9 +65,8 @@ def run_migrations_online() -> None:
and associate a connection with the context. and associate a connection with the context.
""" """
if get_set_engine() is not None: connectable = get_set_engine()
connectable = get_set_engine() if connectable is None:
else:
connectable = engine_from_config( connectable = engine_from_config(
config.get_section(config.config_ini_section, {}), config.get_section(config.config_ini_section, {}),
prefix="sqlalchemy.", prefix="sqlalchemy.",
+7
View File
@@ -29,9 +29,16 @@ module-root = ""
requires = ["uv_build>=0.12.9,<0.13.0"] requires = ["uv_build>=0.12.9,<0.13.0"]
build-backend = "uv_build" build-backend = "uv_build"
[tool.mypy]
explicit_package_bases = true
mypy_path = "."
[tool.ruff] [tool.ruff]
target-version = "py314" target-version = "py314"
[tool.black]
target-version = [ "py314" ]
[tool.ruff.lint] [tool.ruff.lint]
ignore = ["EXE"] ignore = ["EXE"]
+10 -7
View File
@@ -112,6 +112,7 @@ def test_consolidate_b4w_signed_amount_and_category(db_session: Session):
CdtDbtInd="DBIT", CdtDbtInd="DBIT",
) )
staging = upsert_b4w(db_session, export, do_commit=False) staging = upsert_b4w(db_session, export, do_commit=False)
assert staging is not None
consolidate_transactions( consolidate_transactions(
db_session, "b4w", B4wDb, map_b4w_to_transaction, do_commit=False db_session, "b4w", B4wDb, map_b4w_to_transaction, do_commit=False
) )
@@ -130,10 +131,12 @@ def test_ingest_b4w_e2e_idempotent(db_session: Session):
for _ in range(2): for _ in range(2):
ingest_b4w(B4W_PATH, db_session) ingest_b4w(B4W_PATH, db_session)
staging_count = db_session.execute(select(func.count()).select_from(B4wDb)).scalar() staging_count = db_session.execute(
select(func.count()).select_from(B4wDb)
).scalar_one()
transaction_count = db_session.execute( transaction_count = db_session.execute(
select(func.count()).select_from(TransactionDb) select(func.count()).select_from(TransactionDb)
).scalar() ).scalar_one()
assert staging_count > 0 assert staging_count > 0
assert transaction_count == staging_count assert transaction_count == staging_count
@@ -153,10 +156,10 @@ def test_ingest_comdirect_e2e_idempotent(db_session: Session):
staging_count = db_session.execute( staging_count = db_session.execute(
select(func.count()).select_from(ComdirectGiroDb) select(func.count()).select_from(ComdirectGiroDb)
).scalar() ).scalar_one()
transaction_count = db_session.execute( transaction_count = db_session.execute(
select(func.count()).select_from(TransactionDb) select(func.count()).select_from(TransactionDb)
).scalar() ).scalar_one()
assert staging_count > 0 assert staging_count > 0
assert transaction_count == staging_count assert transaction_count == staging_count
@@ -174,13 +177,13 @@ def test_ingest_mixed_sources_into_one_table(db_session: Session):
account_currency="EUR", account_currency="EUR",
) )
b4w_count = db_session.execute(select(func.count()).select_from(B4wDb)).scalar() b4w_count = db_session.execute(select(func.count()).select_from(B4wDb)).scalar_one()
giro_count = db_session.execute( giro_count = db_session.execute(
select(func.count()).select_from(ComdirectGiroDb) select(func.count()).select_from(ComdirectGiroDb)
).scalar() ).scalar_one()
transaction_count = db_session.execute( transaction_count = db_session.execute(
select(func.count()).select_from(TransactionDb) select(func.count()).select_from(TransactionDb)
).scalar() ).scalar_one()
assert b4w_count > 0 assert b4w_count > 0
assert giro_count > 0 assert giro_count > 0