Skip to content

Commit

Permalink
tests: MappedAsDataclass - skip table binding
Browse files Browse the repository at this point in the history
With SQLAlchemy 2.0.36 mapping as a dataclass while also providing
a ``__table__`` attribute is not supported.

Skip associated test when ``MappedAsDataclass`` is in use.

Fixes: pallets-eco#1378
  • Loading branch information
javacruft committed Feb 14, 2025
1 parent 3e3e92b commit c3a9137
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_model_bind.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import pytest
import sqlalchemy as sa
import sqlalchemy.orm as sa_orm

from flask_sqlalchemy import SQLAlchemy

Expand Down Expand Up @@ -76,6 +78,9 @@ class User(db.Model):


def test_explicit_table(db: SQLAlchemy) -> None:
if issubclass(db.Model, (sa_orm.MappedAsDataclass)):
pytest.skip("Explicit table binding with mapped dataclasses not supported")

user_table = db.Table(
"user",
sa.Column("id", sa.Integer, primary_key=True),
Expand Down

0 comments on commit c3a9137

Please sign in to comment.