]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Use define_tables for IsOrIsNotDistinctFromTest
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Apr 2020 20:58:41 +0000 (16:58 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 10 Apr 2020 20:59:45 +0000 (16:59 -0400)
In Ie8127ef29f1ec91e7afb88e1429538c27a321784 Mike
failed to notice that this test is build on TablesTest and
has just the one test function, which means the table is
built up by the fixture.

Change-Id: I855431bc976fe8ec96559ec1a22bb294aecf3c40
(cherry picked from commit e228b4143274152aae599b3dbbcaa4ad7178147b)

lib/sqlalchemy/testing/suite/test_select.py

index 65a2570cdb49b99e68171f05c2e1f316055b0062..06f1aa65c648efd8f5bec3be9e8f8f46a819d218 100644 (file)
@@ -708,7 +708,16 @@ class IsOrIsNotDistinctFromTest(fixtures.TablesTest):
     __backend__ = True
     __requires__ = ("supports_is_distinct_from",)
 
-    @testing.provide_metadata
+    @classmethod
+    def define_tables(cls, metadata):
+        Table(
+            "is_distinct_test",
+            metadata,
+            Column("id", Integer, primary_key=True),
+            Column("col_a", Integer, nullable=True),
+            Column("col_b", Integer, nullable=True),
+        )
+
     @testing.combinations(
         ("both_int_different", 0, 1, 1),
         ("both_int_same", 1, 1, 0),
@@ -721,15 +730,8 @@ class IsOrIsNotDistinctFromTest(fixtures.TablesTest):
     def test_is_or_isnot_distinct_from(
         self, col_a_value, col_b_value, expected_row_count_for_is, connection
     ):
-        meta = self.metadata
-        tbl = Table(
-            "is_distinct_test",
-            meta,
-            Column("id", Integer, primary_key=True),
-            Column("col_a", Integer, nullable=True),
-            Column("col_b", Integer, nullable=True),
-        )
-        meta.create_all()
+        tbl = self.tables.is_distinct_test
+
         connection.execute(
             tbl.insert(),
             [{"id": 1, "col_a": col_a_value, "col_b": col_b_value}],