From a99ba0ec7b52e23cadd7d30bd5612de41b55f8f5 Mon Sep 17 00:00:00 2001 From: Florian Maurer <f.maurer@outlook.de> Date: Tue, 17 Sep 2024 11:00:57 +0200 Subject: [PATCH] fix minimum sqlalchemy version in tests --- .github/workflows/unit.yaml | 2 +- example/forum.py | 6 ++---- example/graph.py | 6 ++---- pyproject.toml | 2 +- tests/test_sqla_multi_key.py | 14 +++++--------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/unit.yaml b/.github/workflows/unit.yaml index 8fc0965..d0fa4f8 100644 --- a/.github/workflows/unit.yaml +++ b/.github/workflows/unit.yaml @@ -40,7 +40,7 @@ jobs: include: # oldest python/sqlalchemy supported - python-version: "3.8" - sqlalchemy-version: "1.4" + sqlalchemy-version: "1.4.18" services: eralchemy-db: image: postgres:alpine diff --git a/example/forum.py b/example/forum.py index a273ff7..4d84391 100644 --- a/example/forum.py +++ b/example/forum.py @@ -17,11 +17,9 @@ from sqlalchemy import ( Unicode, UnicodeText, ) -from sqlalchemy.orm import DeclarativeBase, Relationship +from sqlalchemy.orm import Relationship, declarative_base - -class Base(DeclarativeBase): - pass +Base = declarative_base() post_tags = Table( diff --git a/example/graph.py b/example/graph.py index b6a2d48..aaf083d 100644 --- a/example/graph.py +++ b/example/graph.py @@ -4,13 +4,11 @@ from __future__ import annotations from sqlalchemy import ForeignKey, Integer -from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship +from sqlalchemy.orm import Mapped, declarative_base, mapped_column, relationship from eralchemy import render_er - -class Base(DeclarativeBase): - pass +Base = declarative_base() class Node(Base): diff --git a/pyproject.toml b/pyproject.toml index bdad3cc..3aa824a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers=[ ] requires-python = ">=3.8" dependencies = [ - "sqlalchemy >= 1.4" + "sqlalchemy >= 1.4.18" ] [project.urls] diff --git a/tests/test_sqla_multi_key.py b/tests/test_sqla_multi_key.py index 295a118..cc31ed9 100644 --- a/tests/test_sqla_multi_key.py +++ b/tests/test_sqla_multi_key.py @@ -1,5 +1,5 @@ from sqlalchemy import Column, ForeignKey, String -from sqlalchemy.orm import DeclarativeBase +from sqlalchemy.orm import declarative_base from eralchemy.models import Relation, Table from eralchemy.sqla import ( @@ -8,8 +8,7 @@ from eralchemy.sqla import ( def test_columns_parent(): - class Base(DeclarativeBase): - pass + Base = declarative_base() class Parent(Base): __tablename__ = "parent" @@ -32,8 +31,7 @@ def test_columns_parent(): def test_columns_one_to_many_parent(): - class Base(DeclarativeBase): - pass + Base = declarative_base() class Parent(Base): __tablename__ = "parent" @@ -56,8 +54,7 @@ def test_columns_one_to_many_parent(): def test_columns_one_to_one_parent(): - class Base(DeclarativeBase): - pass + Base = declarative_base() class Parent(Base): __tablename__ = "parent" @@ -79,8 +76,7 @@ def test_columns_one_to_one_parent(): def test_compound_one_to_one_parent(): - class Base(DeclarativeBase): - pass + Base = declarative_base() class Parent(Base): __tablename__ = "parent" -- GitLab