From 80453f9136e1db04c9a4f77a81b9d368b95bd6de Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Mon, 13 Dec 2021 10:50:53 -0500 Subject: [PATCH] Adjust self.assertRaisesRegex messages for py310 The messages returned are slightly different when run with Python 3.10. Story: 2009741 Task: 44177 Change-Id: I26917aefdf43bf3f9008891d2e66aef9b94f58b5 --- heat/tests/openstack/aodh/test_alarm.py | 6 +++--- heat/tests/test_properties.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/heat/tests/openstack/aodh/test_alarm.py b/heat/tests/openstack/aodh/test_alarm.py index cb5b6fb53c..a75f2382c4 100644 --- a/heat/tests/openstack/aodh/test_alarm.py +++ b/heat/tests/openstack/aodh/test_alarm.py @@ -391,12 +391,12 @@ class AodhAlarmTest(common.HeatTestCase): resource_defns = stack.t.resource_definitions(stack) rsrc = alarm.AodhAlarm( 'MEMAlarmHigh', resource_defns['MEMAlarmHigh'], stack) - # python 3.4.3 returns another error message - # so try to handle this by regexp + # python 3.4.3 and python3.10 return slightly different error + # messages, so try to handle this by regexp msg = ("Property error: Resources.MEMAlarmHigh.Properties.%s: " r"int\(\) argument must be a string" "(, a bytes-like object)?" - " or a number, not 'list'" % p) + " or a (real )?number, not 'list'" % p) self.assertRaisesRegex(exception.StackValidationFailed, msg, rsrc.validate) diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py index 97f8a8027c..8e780f73e3 100644 --- a/heat/tests/test_properties.py +++ b/heat/tests/test_properties.py @@ -783,12 +783,12 @@ class PropertyTest(common.HeatTestCase): def test_int_bad(self): schema = {'Type': 'Integer'} p = properties.Property(schema) - # python 3.4.3 returns another error message + # python 3.4.3 and python3.10 return slightly different error messages # try to handle this by regexp self.assertRaisesRegex( TypeError, r"int\(\) argument must be a string" "(, a bytes-like object)?" - " or a number, not 'list'", p.get_value, [1]) + " or a (real )?number, not 'list'", p.get_value, [1]) def test_str_from_int(self): schema = {'Type': 'String'}