From 6bf8238afbcd67a60c92de99113e635f23325c14 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 3 Aug 2024 16:44:22 -0400 Subject: [PATCH] add a test for FK w/ naming convention; update mypy thing There seems to be some dependency for mypy stated in tox for unclear reasons that no longer exists, remove it References: https://github.com/sqlalchemy/alembic/discussions/1029#discussioncomment-10232170 Change-Id: Ied1a578f99ece0875e5d964b4f47a7759c9b2267 --- tests/test_autogen_render.py | 12 ++++++++++++ tox.ini | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_autogen_render.py b/tests/test_autogen_render.py index 254b6ddd..7907f7ec 100644 --- a/tests/test_autogen_render.py +++ b/tests/test_autogen_render.py @@ -2448,6 +2448,18 @@ def test_inline_fk(self): "name=op.f('fk_ct_t_c_q')))", ) + def test_added_fk(self): + t = Table("t", self.metadata, Column("c", Integer, ForeignKey("q.id"))) + + fk = list(t.foreign_key_constraints)[0] + eq_ignore_whitespace( + autogenerate.render._render_foreign_key( + fk, self.autogen_context, self.metadata + ), + "sa.ForeignKeyConstraint(['c'], ['q.id'], " + "name=op.f('fk_ct_t_c_q'))", + ) + def test_render_check_constraint_renamed(self): """test that constraints from autogenerate render with the naming convention name explicitly. These names should diff --git a/tox.ini b/tox.ini index 4b0f082b..f1bfcac3 100644 --- a/tox.ini +++ b/tox.ini @@ -75,7 +75,6 @@ deps= mypy sqlalchemy>=2 mako - types-pkg-resources # is imported in alembic/testing and mypy complains if it's not installed. pytest commands = mypy ./alembic/ --exclude alembic/templates