Skip to content

Commit

Permalink
add a test for FK w/ naming convention; update mypy thing
Browse files Browse the repository at this point in the history
There seems to be some dependency for mypy stated in tox for
unclear reasons that no longer exists, remove it

References: sqlalchemy/alembic#1029 (reply in thread)
Change-Id: Ied1a578f99ece0875e5d964b4f47a7759c9b2267
  • Loading branch information
zzzeek committed Aug 5, 2024
1 parent ff91bbc commit 6bf8238
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/test_autogen_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6bf8238

Please sign in to comment.