]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixes for m2momitjointest
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Jun 2026 16:15:59 +0000 (12:15 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 27 Jun 2026 16:37:47 +0000 (12:37 -0400)
in 808fd28297f36bf932443bae77ca5bb16bcbd4dd , the new test suite
created per-column `ForeignKey` constructs instead of composite
ForeignKeyConstraint objects, leading to failures on all backends
other than SQLite.  The test now runs with backend, and also does not
need AssertsCompiledSQL directives.

Change-Id: Ia52172e22a3f8c37e63f60ce0d2d6b4708a2459b

test/orm/test_selectin_relations.py

index 926002739358e20348cbcdf937231a5df453c459..9ec9eb27e7c3652c4ae250bf4bcb5bc0dc4df176 100644 (file)
@@ -3641,10 +3641,9 @@ class M2OWDegradeTest(
         )
 
 
-class M2MOmitJoinTest(
-    fixtures.TestBase, AssertsExecutionResults, testing.AssertsCompiledSQL
-):
-    __dialect__ = "default"
+class M2MOmitJoinTest(fixtures.TestBase, AssertsExecutionResults):
+    __backend__ = True
+    __only_on__ = ("sqlite", "mysql", "postgresql", "mariadb")
 
     @testing.fixture
     def simple_m2m(self, decl_base, connection):
@@ -3689,10 +3688,12 @@ class M2MOmitJoinTest(
         association_table = Table(
             "a_b",
             decl_base.metadata,
-            Column("a_id1", Integer, ForeignKey("a.id1")),
-            Column("a_id2", Integer, ForeignKey("a.id2")),
-            Column("b_id1", Integer, ForeignKey("b.id1")),
-            Column("b_id2", Integer, ForeignKey("b.id2")),
+            Column("a_id1", Integer),
+            Column("a_id2", Integer),
+            Column("b_id1", Integer),
+            Column("b_id2", Integer),
+            ForeignKeyConstraint(["a_id1", "a_id2"], ["a.id1", "a.id2"]),
+            ForeignKeyConstraint(["b_id1", "b_id2"], ["b.id1", "b.id2"]),
         )
 
         class B(decl_base):
@@ -3750,9 +3751,10 @@ class M2MOmitJoinTest(
         association_table = Table(
             "a_b",
             decl_base.metadata,
-            Column("a_id1", Integer, ForeignKey("a.id1")),
-            Column("a_id2", Integer, ForeignKey("a.id2")),
+            Column("a_id1", Integer),
+            Column("a_id2", Integer),
             Column("b_id", Integer, ForeignKey("b.id")),
+            ForeignKeyConstraint(["a_id1", "a_id2"], ["a.id1", "a.id2"]),
         )
 
         class A(decl_base):
@@ -3805,8 +3807,9 @@ class M2MOmitJoinTest(
             "a_b",
             decl_base.metadata,
             Column("a_id", Integer, ForeignKey("a.id")),
-            Column("b_id1", Integer, ForeignKey("b.id1")),
-            Column("b_id2", Integer, ForeignKey("b.id2")),
+            Column("b_id1", Integer),
+            Column("b_id2", Integer),
+            ForeignKeyConstraint(["b_id1", "b_id2"], ["b.id1", "b.id2"]),
         )
 
         class A(decl_base):