Convert to int can cause different error messages
Starting from python3.4.3 casting list to int, i.e. int([]) returns exception with another messge. Try to fix. Co-Authored-By: Pavlo Shchelokovskyy <pshchelokovskyy@mirantis.com> Closes-Bug: #1499470 Change-Id: I2a312a58ed4b722b998a0ba26a8d2b8fcdc99bd6
This commit is contained in:
parent
8f1ff524f8
commit
2f2a91d2bb
@ -420,12 +420,13 @@ class CeilometerAlarmTest(common.HeatTestCase):
|
|||||||
resource_defns = stack.t.resource_definitions(stack)
|
resource_defns = stack.t.resource_definitions(stack)
|
||||||
rsrc = alarm.CeilometerAlarm(
|
rsrc = alarm.CeilometerAlarm(
|
||||||
'MEMAlarmHigh', resource_defns['MEMAlarmHigh'], stack)
|
'MEMAlarmHigh', resource_defns['MEMAlarmHigh'], stack)
|
||||||
error = self.assertRaises(exception.StackValidationFailed,
|
# python 3.4.3 returns another error message
|
||||||
rsrc.validate)
|
# so try to handle this by regexp
|
||||||
self.assertEqual(
|
msg = ("Property error: Resources.MEMAlarmHigh.Properties.%s: "
|
||||||
"Property error: Resources.MEMAlarmHigh.Properties.%s: "
|
"int\(\) argument must be a string(, a bytes-like "
|
||||||
"int() argument must be a string or a number, not "
|
"object)? or a number, not 'list'" % p)
|
||||||
"'list'" % p, six.text_type(error))
|
self.assertRaisesRegexp(exception.StackValidationFailed,
|
||||||
|
msg, rsrc.validate)
|
||||||
|
|
||||||
def test_mem_alarm_high_check_not_required_parameters(self):
|
def test_mem_alarm_high_check_not_required_parameters(self):
|
||||||
snippet = template_format.parse(not_string_alarm_template)
|
snippet = template_format.parse(not_string_alarm_template)
|
||||||
|
@ -743,9 +743,11 @@ class PropertyTest(common.HeatTestCase):
|
|||||||
def test_int_bad(self):
|
def test_int_bad(self):
|
||||||
schema = {'Type': 'Integer'}
|
schema = {'Type': 'Integer'}
|
||||||
p = properties.Property(schema)
|
p = properties.Property(schema)
|
||||||
ex = self.assertRaises(TypeError, p.get_value, [1])
|
# python 3.4.3 returns another error message
|
||||||
self.assertEqual("int() argument must be a string or a number, "
|
# try to handle this by regexp
|
||||||
"not 'list'", six.text_type(ex))
|
self.assertRaisesRegexp(
|
||||||
|
TypeError, "int\(\) argument must be a string(, a bytes-like "
|
||||||
|
"object)? or a number, not 'list'", p.get_value, [1])
|
||||||
|
|
||||||
def test_str_from_int(self):
|
def test_str_from_int(self):
|
||||||
schema = {'Type': 'String'}
|
schema = {'Type': 'String'}
|
||||||
|
Loading…
Reference in New Issue
Block a user