From c1a64c94ef848f825e6a36581814511a81945428 Mon Sep 17 00:00:00 2001 From: Alessandro Pilotti Date: Fri, 14 Feb 2014 19:22:35 +0200 Subject: [PATCH] Fixes the Hyper-V VolumeOpsTestCase base class The VolumeOpsTestCase base class inherits incorrectly from HyperVAPITestCase, with the unwanted side effect of executing all base class tests as well. This patch generalizes a common base class from HyperVAPITestCase and fixes the inheritance issue. Closes-Bug: #1280379 Change-Id: Ic81beb8397138c16c8d2d88a9c9d05d2b76e0e83 --- nova/tests/virt/hyperv/test_hypervapi.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nova/tests/virt/hyperv/test_hypervapi.py b/nova/tests/virt/hyperv/test_hypervapi.py index fb0c5af53885..ed5b164e1ab1 100644 --- a/nova/tests/virt/hyperv/test_hypervapi.py +++ b/nova/tests/virt/hyperv/test_hypervapi.py @@ -69,15 +69,15 @@ CONF = cfg.CONF CONF.import_opt('vswitch_name', 'nova.virt.hyperv.vif', 'hyperv') -class HyperVAPITestCase(test.NoDBTestCase): - """Unit tests for Hyper-V driver calls.""" +class HyperVAPIBaseTestCase(test.NoDBTestCase): + """Base unit tests class for Hyper-V driver calls.""" def __init__(self, test_case_name): self._mox = mox.Mox() - super(HyperVAPITestCase, self).__init__(test_case_name) + super(HyperVAPIBaseTestCase, self).__init__(test_case_name) def setUp(self): - super(HyperVAPITestCase, self).setUp() + super(HyperVAPIBaseTestCase, self).setUp() self._user_id = 'fake' self._project_id = 'fake' @@ -248,7 +248,11 @@ class HyperVAPITestCase(test.NoDBTestCase): def tearDown(self): self._mox.UnsetStubs() - super(HyperVAPITestCase, self).tearDown() + super(HyperVAPIBaseTestCase, self).tearDown() + + +class HyperVAPITestCase(HyperVAPIBaseTestCase): + """Unit tests for Hyper-V driver calls.""" def test_get_available_resource(self): cpu_info = {'Architecture': 'fake', @@ -1666,7 +1670,7 @@ class HyperVAPITestCase(test.NoDBTestCase): self.assertEqual(fake_vm_id, connect_info['internal_access_path']) -class VolumeOpsTestCase(HyperVAPITestCase): +class VolumeOpsTestCase(HyperVAPIBaseTestCase): """Unit tests for VolumeOps class.""" def setUp(self):