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
This commit is contained in:
Corey Bryant 2021-12-13 10:50:53 -05:00
parent fe8fba8c98
commit 80453f9136
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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'}