]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
A few adjustments for tests to succeed on python 3.5
authorFederico Caselli <cfederico87@gmail.com>
Wed, 8 Apr 2020 18:54:26 +0000 (20:54 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Mon, 13 Apr 2020 10:24:59 +0000 (10:24 +0000)
Ported from Change-Id: Ia93ee1cb5c52e51e72eb0a24c100421c5157d04b

Change-Id: Ia1086d3013b74ef0b2b69381483a9501288853a9

test/base/test_utils.py
test/orm/test_unitofwork.py

index e0944b73ce38b4d9ad0440e097eaacc2dc42f71e..775f341fc0c6c5e370d2f311f4c9721b5c7b52d2 100644 (file)
@@ -2805,6 +2805,8 @@ class TimezoneTest(fixtures.TestBase):
         ),
     )
     def test_tzname(self, td, expected):
+        if expected == "UTC" and util.py3k and not util.py36:
+            expected += "+00:00"
         eq_(timezone(td).tzname(None), expected)
 
     def test_utcoffset(self):
index f5cc4836f2af5f07876de026db0eba45dbab442d..6e68b5899622d17fd25063845025c1859cf21505 100644 (file)
@@ -3473,12 +3473,22 @@ class EnsurePKSortableTest(fixtures.MappedTest):
         a.data = "bar"
         b.data = "foo"
         if sa.util.py3k:
+            if sa.util.py36:
+                message = (
+                    r"Could not sort objects by primary key; primary key "
+                    r"values must be sortable in Python \(was: '<' not "
+                    r"supported between instances of 'MyNotSortableEnum'"
+                    r" and 'MyNotSortableEnum'\)"
+                )
+            else:
+                message = (
+                    r"Could not sort objects by primary key; primary key "
+                    r"values must be sortable in Python \(was: unorderable "
+                    r"types: MyNotSortableEnum\(\) < MyNotSortableEnum\(\)\)"
+                )
+
             assert_raises_message(
-                sa.exc.InvalidRequestError,
-                r"Could not sort objects by primary key; primary key values "
-                r"must be sortable in Python \(was: '<' not supported between "
-                r"instances of 'MyNotSortableEnum' and 'MyNotSortableEnum'\)",
-                s.flush,
+                sa.exc.InvalidRequestError, message, s.flush,
             )
         else:
             s.flush()