Remove deprecated use Exception.message

This usage is deprecated since Python 2.6. Use the recommended
style instead. str is also replaced with unicode.

Change-Id: I2adfd7fdfdf47b70ef170a2daa28926764cf0337
This commit is contained in:
Yun Mao
2012-08-07 10:34:45 -04:00
parent 69315f45d5
commit 429d39d1dc

View File

@@ -1928,9 +1928,9 @@ class LibvirtConnTestCase(test.TestCase):
conn.spawn(self.context, instance, None, network_info)
except Exception, e:
# assert that no exception is raised due to sha1 receiving an int
self.assertEqual(-1, str(e.message).find('must be string or buffer'
self.assertEqual(-1, unicode(e).find('must be string or buffer'
', not int'))
count = (0 <= str(e.message).find('Unexpected method call'))
count = (0 <= unicode(e).find('Unexpected method call'))
path = os.path.join(FLAGS.instances_path, instance.name)
if os.path.isdir(path):