]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
add a test for FK w/ naming convention; update mypy thing
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Aug 2024 20:44:22 +0000 (16:44 -0400)
committerMichael Bayer <mike_mp@zzzcomputing.com>
Mon, 5 Aug 2024 13:51:08 +0000 (13:51 +0000)
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
tox.ini

index 254b6ddd1253291c2e8986e46666410c95ea81a1..7907f7ec6262d003fc63a2fbf023c9463d4ac33a 100644 (file)
@@ -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 4b0f082bd7ae23924b897220d848f5298847f4ad..f1bfcac35235edca0c8981fc4d6d22a69af3f287 100644 (file)
--- 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