From: Mike Bayer Date: Sat, 3 Aug 2024 20:44:22 +0000 (-0400) Subject: add a test for FK w/ naming convention; update mypy thing X-Git-Tag: rel_1_13_3~10 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bf8238afbcd67a60c92de99113e635f23325c14;p=thirdparty%2Fsqlalchemy%2Falembic.git 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 --- 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 @@ class RenderNamingConventionTest(TestBase): "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