From 2cdcb229ee0cc5aa082ae3afb918a7fd4a2d2d44 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Wed, 8 Apr 2020 20:54:26 +0200 Subject: [PATCH] A few adjustments for tests to succeed on python 3.5 Ported from Change-Id: Ia93ee1cb5c52e51e72eb0a24c100421c5157d04b Change-Id: Ia1086d3013b74ef0b2b69381483a9501288853a9 --- test/base/test_utils.py | 2 ++ test/orm/test_unitofwork.py | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/base/test_utils.py b/test/base/test_utils.py index e0944b73ce..775f341fc0 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -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): diff --git a/test/orm/test_unitofwork.py b/test/orm/test_unitofwork.py index f5cc4836f2..6e68b58996 100644 --- a/test/orm/test_unitofwork.py +++ b/test/orm/test_unitofwork.py @@ -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() -- 2.39.5