Raise NotImplementedError instead of NotImplemented

NotImplementedError is the name of the exception
(https://docs.python.org/2/library/exceptions.html).
NotImplemented is the name of a constant
(https://docs.python.org/2/library/constants.html).
>>> raise NotImplemented()
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    raise NotImplemented()
TypeError: 'NotImplementedType' object is not callable
>>> raise NotImplementedError()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    raise NotImplementedError()
NotImplementedError
This patch fix it.

Change-Id: I939eaa4b4b7c574f7a6447725e3a6ad5b128f1b7
Closes-Bug: #1339855
This commit is contained in:
Ji-Wei 2016-09-09 13:06:26 +08:00
parent 0f651de035
commit 2a66246536
2 changed files with 2 additions and 2 deletions

View File

@ -154,7 +154,7 @@ class ResourceInfo(object):
return False
def get_class(self):
raise NotImplemented
raise NotImplementedError
def get_class_to_instantiate(self):
return self.get_class()

View File

@ -1193,7 +1193,7 @@ class ResourceTest(common.HeatTestCase):
prop_diff = {'Foo': 'xyz'}
self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_update')
generic_rsrc.ResourceWithProps.handle_update(
utmpl, tmpl_diff, prop_diff).AndRaise(NotImplemented)
utmpl, tmpl_diff, prop_diff).AndRaise(NotImplementedError)
self.m.ReplayAll()
updater = scheduler.TaskRunner(res.update, utmpl)
self.assertRaises(exception.ResourceFailure, updater)