From f51c56b8dca0569269a69bd85c25fcfed39a3c9e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 2 Jun 2021 15:56:15 -0400 Subject: [PATCH] apply sorting to overlaps message so that string comparison tests are deterministic Change-Id: Ia072f225fb906ea43c451eb4217856f144932fd2 --- lib/sqlalchemy/orm/relationships.py | 8 +++++--- test/orm/test_relationships.py | 18 +++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index 171df3e21a..2d1ed6ced8 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -3459,10 +3459,12 @@ class JoinCondition(object): from_, to_, ", ".join( - "'%s' (copies %s to %s)" % (pr, fr_, to_) - for (pr, fr_) in other_props + sorted( + "'%s' (copies %s to %s)" % (pr, fr_, to_) + for (pr, fr_) in other_props + ) ), - ",".join(pr.key for pr, fr in other_props), + ",".join(sorted(pr.key for pr, fr in other_props)), self.prop, ), code="qzyx", diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index e14db9f803..8f622d705e 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -913,32 +913,32 @@ class OverlappingFksSiblingTest(fixtures.TestBase): with expect_warnings( r"relationship 'A.bs' will copy column a.id to column b.a_id, " r"which conflicts with relationship\(s\): " - r"'C.as' \(copies a.id to b.a_id\), " - r"'A.cs' \(copies a.id to b.a_id\)" + r"'A.cs' \(copies a.id to b.a_id\), " + r"'C.as' \(copies a.id to b.a_id\)" r".*add the parameter 'overlaps=\"as,cs\"' to the 'A.bs' " r"relationship", # # r"relationship 'B.a' will copy column a.id to column b.a_id, " r"which conflicts with relationship\(s\): " - r"'C.as' \(copies a.id to b.a_id\), " - r"'A.cs' \(copies a.id to b.a_id\)..*" - r"add the parameter 'overlaps=\"as,cs\"' to the 'B.a' " + r"'A.cs' \(copies a.id to b.a_id\), " + r"'C.as' \(copies a.id to b.a_id\)" + r".*add the parameter 'overlaps=\"as,cs\"' to the 'B.a' " r"relationship", # # r"relationship 'B.c' will copy column c.id to column b.c_id, " r"which conflicts with relationship\(s\): " - r"'C.as' \(copies c.id to b.c_id\), " - r"'A.cs' \(copies c.id to b.c_id\)" + r"'A.cs' \(copies c.id to b.c_id\), " + r"'C.as' \(copies c.id to b.c_id\)" r".*add the parameter 'overlaps=\"as,cs\"' to the 'B.c' " r"relationship", # # r"relationship 'C.bs' will copy column c.id to column b.c_id, " r"which conflicts with relationship\(s\): " - r"'C.as' \(copies c.id to b.c_id\), " - r"'A.cs' \(copies c.id to b.c_id\)" + r"'A.cs' \(copies c.id to b.c_id\), " + r"'C.as' \(copies c.id to b.c_id\)" r".*add the parameter 'overlaps=\"as,cs\"' to the 'C.bs' " r"relationship", ): -- 2.47.2