Merge "Enable nova exception format checking in tests."
This commit is contained in:
@@ -2036,7 +2036,9 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
|
||||
self.mox.StubOutWithMock(conn, '_compare_cpu')
|
||||
|
||||
conn._compare_cpu("asdf").AndRaise(exception.InvalidCPUInfo)
|
||||
conn._compare_cpu("asdf").AndRaise(exception.InvalidCPUInfo(
|
||||
reason='foo')
|
||||
)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.assertRaises(exception.InvalidCPUInfo,
|
||||
@@ -2628,7 +2630,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
|
||||
def test_immediate_delete(self):
|
||||
def fake_lookup_by_name(instance_name):
|
||||
raise exception.InstanceNotFound()
|
||||
raise exception.InstanceNotFound(instance_id=instance_name)
|
||||
|
||||
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
self.stubs.Set(conn, '_lookup_by_name', fake_lookup_by_name)
|
||||
@@ -2731,7 +2733,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
return mock
|
||||
|
||||
def fake_get_info(instance_name):
|
||||
raise exception.InstanceNotFound()
|
||||
raise exception.InstanceNotFound(instance_id=instance_name)
|
||||
|
||||
conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
|
||||
self.stubs.Set(conn, '_lookup_by_name', fake_lookup_by_name)
|
||||
@@ -2750,7 +2752,7 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
self.stubs.Set(conn, 'list_instances', list_instances)
|
||||
|
||||
def get_info(instance_name):
|
||||
raise exception.InstanceNotFound()
|
||||
raise exception.InstanceNotFound(instance_id='fake')
|
||||
self.stubs.Set(conn, 'get_instance_disk_info', get_info)
|
||||
|
||||
result = conn.get_disk_available_least()
|
||||
|
@@ -27,6 +27,8 @@ class ExceptionTestCase(test.TestCase):
|
||||
raise exc()
|
||||
|
||||
def test_exceptions_raise(self):
|
||||
# NOTE(dprince): disable format errors since we are not passing kwargs
|
||||
self.flags(fatal_exception_format_errors=False)
|
||||
for name in dir(exception):
|
||||
exc = getattr(exception, name)
|
||||
if isinstance(exc, type):
|
||||
|
Reference in New Issue
Block a user