Raise NotImplementedError

We were incorrectly raising NotImplemented as an exception instead of
the proper NotImplementedError.

This patch fixes this and ensures we are always raising
NotImplementedError.
This commit is contained in:
Gorka Eguileor
2018-11-07 18:53:15 +01:00
parent e2c10eebdf
commit 9f8d4b8753
2 changed files with 10 additions and 10 deletions

View File

@@ -34,20 +34,20 @@ class PersistenceDriverBase(object):
@property @property
def db(self): def db(self):
raise NotImplemented() raise NotImplementedError()
def get_volumes(self, volume_id=None, volume_name=None, backend_name=None): def get_volumes(self, volume_id=None, volume_name=None, backend_name=None):
raise NotImplemented() raise NotImplementedError()
def get_snapshots(self, snapshot_id=None, snapshot_name=None, def get_snapshots(self, snapshot_id=None, snapshot_name=None,
volume_id=None): volume_id=None):
raise NotImplemented() raise NotImplementedError()
def get_connections(self, connection_id=None, volume_id=None): def get_connections(self, connection_id=None, volume_id=None):
raise NotImplemented() raise NotImplementedError()
def get_key_values(self, key): def get_key_values(self, key):
raise NotImplemented() raise NotImplementedError()
def set_volume(self, volume): def set_volume(self, volume):
self.reset_change_tracker(volume) self.reset_change_tracker(volume)

View File

@@ -115,10 +115,10 @@ class BasePersistenceTest(unittest2.TestCase):
self.assertDictEqual(exp, act) self.assertDictEqual(exp, act)
def test_db(self): def test_db(self):
raise NotImplemented('Test class must implement this method') raise NotImplementedError('Test class must implement this method')
def test_set_volume(self): def test_set_volume(self):
raise NotImplemented('Test class must implement this method') raise NotImplementedError('Test class must implement this method')
def test_get_volumes_all(self): def test_get_volumes_all(self):
vols = self.create_n_volumes(2) vols = self.create_n_volumes(2)
@@ -199,7 +199,7 @@ class BasePersistenceTest(unittest2.TestCase):
self.assertListEqualObj(vols, self.sorted(res)) self.assertListEqualObj(vols, self.sorted(res))
def test_set_snapshot(self): def test_set_snapshot(self):
raise NotImplemented('Test class must implement this method') raise NotImplementedError('Test class must implement this method')
def get_snapshots_all(self): def get_snapshots_all(self):
snaps = self.create_snapshots() snaps = self.create_snapshots()
@@ -277,7 +277,7 @@ class BasePersistenceTest(unittest2.TestCase):
self.assertListEqualObj(snaps, self.sorted(res)) self.assertListEqualObj(snaps, self.sorted(res))
def test_set_connection(self): def test_set_connection(self):
raise NotImplemented('Test class must implement this method') raise NotImplementedError('Test class must implement this method')
def get_connections_all(self): def get_connections_all(self):
conns = self.create_connections() conns = self.create_connections()
@@ -341,7 +341,7 @@ class BasePersistenceTest(unittest2.TestCase):
self.assertListEqualObj(conns, self.sorted(res)) self.assertListEqualObj(conns, self.sorted(res))
def test_set_key_values(self): def test_set_key_values(self):
raise NotImplemented('Test class must implement this method') raise NotImplementedError('Test class must implement this method')
def assertKVsEqual(self, expected, actual): def assertKVsEqual(self, expected, actual):
if len(expected) == len(actual): if len(expected) == len(actual):