Fixes tests method resolution

Python allows multiple inheritance, which we use in order to mix and
match test scenarios and actions.

Python performs method resolution as follows:
- checks if the method is defined in the current class.
- if not, check parents, left to right.

Since all tests have test_base as its left-most parent, all methods
are resolved in test_base, which is not the desired behaviour. This
affects optional_feature mixin in particular.

Change-Id: I19d3bdef85a12ef45b600aa4fc68afd390b96c9f
This commit is contained in:
Claudiu Belu 2017-09-07 05:11:51 -07:00
parent 975fe2382d
commit ab50a17aff
6 changed files with 15 additions and 15 deletions

View File

@ -29,10 +29,10 @@ CONF = config.CONF
LOG = logging.getLogger(__name__)
class HyperVClusterTest(test_base.TestBase,
migrate._MigrateMixin,
class HyperVClusterTest(migrate._MigrateMixin,
migrate._LiveMigrateMixin,
resize._ResizeMixin):
resize._ResizeMixin,
test_base.TestBase):
"""The test suite for the Hyper-V Cluster.

View File

@ -62,7 +62,7 @@ class _BaseDiskTestMixin(migrate._MigrateMixin,
self._check_resize(flavor, new_flavor['id'], expected_fail=True)
class VhdDiskTest(test_base.TestBase, _BaseDiskTestMixin):
class VhdDiskTest(_BaseDiskTestMixin, test_base.TestBase):
_IMAGE_REF = CONF.hyperv.vhd_image_ref
_CONF_OPTION_NAME = 'hyperv.vhd_image_ref'
@ -71,14 +71,14 @@ class VhdDiskTest(test_base.TestBase, _BaseDiskTestMixin):
# TODO(claudiub): validate that the images really are VHD / VHDX.
class VhdxDiskTest(test_base.TestBase, _BaseDiskTestMixin):
class VhdxDiskTest(_BaseDiskTestMixin, test_base.TestBase):
_IMAGE_REF = CONF.hyperv.vhdx_image_ref
_CONF_OPTION_NAME = 'hyperv.vhdx_image_ref'
_FLAVOR_SUFFIX = 'vhdx'
class Generation2DiskTest(test_base.TestBase, _BaseDiskTestMixin):
class Generation2DiskTest(_BaseDiskTestMixin, test_base.TestBase):
# Generation 2 VMs have been introduced in Windows / Hyper-V Server 2012 R2
_MIN_HYPERV_VERSION = 6003

View File

@ -19,8 +19,8 @@ from oswin_tempest_plugin.tests._mixins import optional_feature
from oswin_tempest_plugin.tests import test_base
class QosTestCase(test_base.TestBase,
optional_feature._OptionalFeatureMixin):
class QosTestCase(optional_feature._OptionalFeatureMixin,
test_base.TestBase):
"""QoS test suite.
This test suite will spawn instances with QoS specs.

View File

@ -20,8 +20,8 @@ from oswin_tempest_plugin.tests import test_base
CONF = config.CONF
class RemoteFxTestCase(test_base.TestBase,
optional_feature._OptionalFeatureMixin):
class RemoteFxTestCase(optional_feature._OptionalFeatureMixin,
test_base.TestBase):
"""RemoteFX test suite.
This test suit will spawn instances with RemoteFX enabled.

View File

@ -20,8 +20,8 @@ from oswin_tempest_plugin.tests import test_base
CONF = config.CONF
class SecureBootTestCase(test_base.TestBase,
optional_feature._OptionalFeatureMixin):
class SecureBootTestCase(optional_feature._OptionalFeatureMixin,
test_base.TestBase):
"""Secure boot test suite.
This test suite will spawn instances requiring secure boot to be

View File

@ -24,12 +24,12 @@ from oswin_tempest_plugin.tests import test_base
CONF = config.CONF
class HyperVvNumaTestCase(test_base.TestBase,
migrate._MigrateMixin,
class HyperVvNumaTestCase(migrate._MigrateMixin,
migrate._LiveMigrateMixin,
optional_feature._OptionalFeatureMixin,
resize._ResizeMixin,
resize._ResizeNegativeMixin):
resize._ResizeNegativeMixin,
test_base.TestBase):
"""Hyper-V vNUMA test suite.
This test suite will spawn instances requiring NUMA placement.