]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Raise NotImplementedError instead of NotImplemented
authorChristian Berendt <berendt@b1-systems.de>
Fri, 4 Jul 2014 11:12:26 +0000 (13:12 +0200)
committerChristian Berendt <berendt@b1-systems.de>
Wed, 13 Aug 2014 08:54:07 +0000 (10:54 +0200)
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).

It makes no sense to raise a constant. The exception should
be raised instead.

Change-Id: I4969e26eb7b46f008ea3c8bd0093490c425f7069
Closes-Bug: #1339855

neutron/agent/linux/polling.py
neutron/tests/unit/agent/linux/test_polling.py

index 23168085fdec0e2e6fcd458d1177f3bcd2574e8b..9e2163ac28753be2adff5b2b20f5781756ac0358 100644 (file)
@@ -52,7 +52,7 @@ class BasePollingManager(object):
         self._polling_completed = True
 
     def _is_polling_required(self):
-        raise NotImplemented
+        raise NotImplementedError()
 
     @property
     def is_polling_required(self):
index 90b48e0bc9edadab6be0e6a528b179d6c37834ab..ba18a864837dfbe97e85332f2e0dd94f6e1a06fc 100644 (file)
@@ -43,6 +43,9 @@ class TestBasePollingManager(base.BaseTestCase):
         super(TestBasePollingManager, self).setUp()
         self.pm = polling.BasePollingManager()
 
+    def test__is_polling_required_should_not_be_implemented(self):
+        self.assertRaises(NotImplementedError, self.pm._is_polling_required)
+
     def test_force_polling_sets_interval_attribute(self):
         self.assertFalse(self.pm._force_polling)
         self.pm.force_polling()