Prevent lint error in mocked classes
authorMichele Tartara <mtartara@google.com>
Fri, 27 Sep 2013 10:40:39 +0000 (10:40 +0000)
committerMichele Tartara <mtartara@google.com>
Fri, 27 Sep 2013 11:25:51 +0000 (11:25 +0000)
Accessing private methods of parent classes is bad, but it is sometimes the best
approach for classes mocking them for testing reasons.
Selectively disable the related lint error just for the few functions that need
to do it.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Jose A. Lopes <jabolopes@google.com>

test/py/cmdlib/testsupport/lock_manager_mock.py
test/py/cmdlib/testsupport/processor_mock.py

index 5c5f8f6..068086e 100644 (file)
@@ -31,6 +31,7 @@ class LockManagerMock(locking.GanetiLockManager):
   """
   def __init__(self):
     # reset singleton instance, there is a separate lock manager for every test
+    # pylint: disable=W0212
     self.__class__._instance = None
 
     super(LockManagerMock, self).__init__([], [], [], [])
index 5884dcf..5d39b47 100644 (file)
@@ -79,6 +79,7 @@ class ProcessorMock(mcpu.Processor):
     return self.ExecOpCode(op, LogRecordingCallback(self))
 
   def _ExecLU(self, lu):
+    # pylint: disable=W0212
     if not self._lu_test_func:
       return super(ProcessorMock, self)._ExecLU(lu)
     else:
@@ -87,6 +88,7 @@ class ProcessorMock(mcpu.Processor):
       return self._lu_test_func(lu)
 
   def _CheckLUResult(self, op, result):
+    # pylint: disable=W0212
     if not self._lu_test_func:
       return super(ProcessorMock, self)._CheckLUResult(op, result)
     else: