]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add order_by clause to make tests stable
authorJan <BY-jk@users.noreply.github.com>
Wed, 18 Oct 2017 01:23:19 +0000 (21:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Oct 2017 01:23:19 +0000 (21:23 -0400)
I observed test runs that failed on 'test_bound_in_scalar' due to arbitrary ordering of the result set. The assertion not only tests for the elements to be present, but also for the correct ordering. Hence, the proposal to add an order_by clause to the select statements.

Change-Id: If1fbb864761e77dfd2a42ef857801c8aaf893bee
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/389

lib/sqlalchemy/testing/suite/test_select.py

index 22ae1d8c5758b570003119a2d560ceb2f498fca0..77535e1a326ce3093c0ff12e4d56b965a952a976 100644 (file)
@@ -345,7 +345,7 @@ class ExpandingBoundInTest(fixtures.TablesTest):
         table = self.tables.some_table
 
         stmt = select([table.c.id]).where(
-            table.c.x.in_(bindparam('q', expanding=True)))
+            table.c.x.in_(bindparam('q', expanding=True))).order_by(table.c.id)
 
         self._assert_result(
             stmt,
@@ -358,7 +358,7 @@ class ExpandingBoundInTest(fixtures.TablesTest):
         table = self.tables.some_table
 
         stmt = select([table.c.id]).where(
-            tuple_(table.c.x, table.c.y).in_(bindparam('q', expanding=True)))
+            tuple_(table.c.x, table.c.y).in_(bindparam('q', expanding=True))).order_by(table.c.id)
 
         self._assert_result(
             stmt,