Skip to content

Commit c3a9137

Browse files
author
James Page
committed
tests: MappedAsDataclass - skip table binding
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
1 parent 3e3e92b commit c3a9137

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_model_bind.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import annotations
22

3+
import pytest
34
import sqlalchemy as sa
5+
import sqlalchemy.orm as sa_orm
46

57
from flask_sqlalchemy import SQLAlchemy
68

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

7779

7880
def test_explicit_table(db: SQLAlchemy) -> None:
81+
if issubclass(db.Model, (sa_orm.MappedAsDataclass)):
82+
pytest.skip("Explicit table binding with mapped dataclasses not supported")
83+
7984
user_table = db.Table(
8085
"user",
8186
sa.Column("id", sa.Integer, primary_key=True),

0 commit comments

Comments
 (0)