From dfb83f4948e0358b989275e384cc5ed640026906 Mon Sep 17 00:00:00 2001 From: James Page Date: Thu, 5 Jul 2018 06:37:10 -0500 Subject: [PATCH] py37: deal with Exception repr changes Under Python 3.7, a trailing comma is no longer added to the init parameters generated by a repr() call: >>> repr(Exception('It Works')) "Exception('It Works')" vs >>> repr(Exception('It Works')) "Exception('It Works',)" Support pre and post Python 3.7 formats in test cases for notification middleware. Change-Id: I30a46ae82f2cc1b529287c049aa5fc6d987e2538 --- oslo_messaging/tests/notify/test_middleware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oslo_messaging/tests/notify/test_middleware.py b/oslo_messaging/tests/notify/test_middleware.py index f5deef354..65ee79c29 100644 --- a/oslo_messaging/tests/notify/test_middleware.py +++ b/oslo_messaging/tests/notify/test_middleware.py @@ -130,7 +130,8 @@ class NotifierMiddlewareTest(utils.BaseTestCase): exception = call_args[2]['exception'] self.assertIn('middleware.py', exception['traceback'][0]) self.assertIn('It happens!', exception['traceback'][-1]) - self.assertEqual("Exception('It happens!',)", exception['value']) + self.assertTrue(exception['value'] in ("Exception('It happens!',)", + "Exception('It happens!')")) def test_process_request_fail(self): def notify_error(context, publisher_id, event_type,