Skip to content

Commit

Permalink
dont duplicate ModelOne; block A005
Browse files Browse the repository at this point in the history
this is already in the fixtures.  block new flake8 A005
warning nobody asked for

Change-Id: Ic4f3ec3d1eee5333edb3f48ac95b09ad1b8fdbdf
  • Loading branch information
zzzeek committed Apr 17, 2024
1 parent 0bc8c63 commit 44965f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 99 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ where = tests
enable-extensions = G
# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
ignore =
A003,
A003,A005
D,
E203,E305,E704,E711,E712,E721,E722,E741,
N801,N802,N806,
Expand Down
99 changes: 1 addition & 98 deletions tests/test_autogen_diffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
from alembic.testing.suite._autogen_fixtures import _default_object_filters
from alembic.testing.suite._autogen_fixtures import AutogenFixtureTest
from alembic.testing.suite._autogen_fixtures import AutogenTest
from alembic.testing.suite._autogen_fixtures import ModelOne
from alembic.util import CommandError

# TODO: we should make an adaptation of CompareMetadataToInspectorTest that is
Expand Down Expand Up @@ -315,104 +316,6 @@ def _include_object(obj, name, type_, reflected, compare_to):
eq_(len(diffs), 0)


class ModelOne:
__requires__ = ("unique_constraint_reflection",)

schema = None

@classmethod
def _get_db_schema(cls):
schema = cls.schema

m = MetaData(schema=schema)

Table(
"user",
m,
Column("id", Integer, primary_key=True),
Column("name", String(50)),
Column("a1", Text),
Column("pw", String(50)),
Index("pw_idx", "pw"),
)

Table(
"address",
m,
Column("id", Integer, primary_key=True),
Column("email_address", String(100), nullable=False),
)

Table(
"order",
m,
Column("order_id", Integer, primary_key=True),
Column(
"amount",
Numeric(8, 2),
nullable=False,
server_default=text("0"),
),
CheckConstraint("amount >= 0", name="ck_order_amount"),
)

Table(
"extra",
m,
Column("x", CHAR),
Column("uid", Integer, ForeignKey("user.id")),
)

return m

@classmethod
def _get_model_schema(cls):
schema = cls.schema

m = MetaData(schema=schema)

Table(
"user",
m,
Column("id", Integer, primary_key=True),
Column("name", String(50), nullable=False),
Column("a1", Text, server_default="x"),
)

Table(
"address",
m,
Column("id", Integer, primary_key=True),
Column("email_address", String(100), nullable=False),
Column("street", String(50)),
UniqueConstraint("email_address", name="uq_email"),
)

Table(
"order",
m,
Column("order_id", Integer, primary_key=True),
Column(
"amount",
Numeric(10, 2),
nullable=True,
server_default=text("0"),
),
Column("user_id", Integer, ForeignKey("user.id")),
CheckConstraint("amount > -1", name="ck_order_amount"),
)

Table(
"item",
m,
Column("id", Integer, primary_key=True),
Column("description", String(100)),
Column("order_id", Integer, ForeignKey("order.order_id")),
CheckConstraint("len(description) > 5"),
)
return m


class AutogenerateDiffTest(ModelOne, AutogenTest, TestBase):
__only_on__ = "sqlite"

Expand Down

0 comments on commit 44965f0

Please sign in to comment.