From: Iustin Pop <[email protected]>

Python 2.7 has a very nice extension to the unittest module to support
test skipping, but until we officially stop supporting it we pretend
these pass.

Signed-off-by: Iustin Pop <[email protected]>
---
 test/py/ganeti.hypervisor.hv_kvm_unittest.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/py/ganeti.hypervisor.hv_kvm_unittest.py 
b/test/py/ganeti.hypervisor.hv_kvm_unittest.py
index 55ffb9b..53097fd 100755
--- a/test/py/ganeti.hypervisor.hv_kvm_unittest.py
+++ b/test/py/ganeti.hypervisor.hv_kvm_unittest.py
@@ -633,6 +633,9 @@ class TestKvmCpuPinning(testutils.GanetiTestCase):
     self.params = constants.HVC_DEFAULTS[constants.HT_KVM].copy()
 
   def testCpuPinningDefault(self):
+    if hv_kvm.psutil is None:
+      # FIXME: switch to unittest.skip once python 2.6 is deprecated
+      return
     mock_process = mock.MagicMock()
     cpu_mask = self.params['cpu_mask']
     worker_cpu_mask = self.params['worker_cpu_mask']
@@ -646,6 +649,9 @@ class TestKvmCpuPinning(testutils.GanetiTestCase):
                      mock.call(range(0,1237)))
 
   def testCpuPinningPerVcpu(self):
+    if hv_kvm.psutil is None:
+      # FIXME: switch to unittest.skip once python 2.6 is deprecated
+      return
     mock_process = mock.MagicMock()
     mock_process.set_cpu_affinity = mock.MagicMock()
     mock_process.set_cpu_affinity().return_value = True
@@ -671,6 +677,9 @@ class TestKvmCpuPinning(testutils.GanetiTestCase):
                        mock.call([15, 16, 17]))
 
   def testCpuPinningEntireInstance(self):
+    if hv_kvm.psutil is None:
+      # FIXME: switch to unittest.skip once python 2.6 is deprecated
+      return
     mock_process = mock.MagicMock()
     mock_process.set_cpu_affinity = mock.MagicMock()
     mock_process.set_cpu_affinity().return_value = True
-- 
2.8.1

Reply via email to