From ab50a17affc69c69beeff7695652ec784dbaa758 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Thu, 7 Sep 2017 05:11:51 -0700 Subject: [PATCH] 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 --- oswin_tempest_plugin/tests/scenario/test_cluster.py | 6 +++--- oswin_tempest_plugin/tests/scenario/test_disks.py | 6 +++--- oswin_tempest_plugin/tests/scenario/test_qos.py | 4 ++-- oswin_tempest_plugin/tests/scenario/test_remotefx.py | 4 ++-- oswin_tempest_plugin/tests/scenario/test_secure_boot.py | 4 ++-- oswin_tempest_plugin/tests/scenario/test_vnuma.py | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/oswin_tempest_plugin/tests/scenario/test_cluster.py b/oswin_tempest_plugin/tests/scenario/test_cluster.py index 92ae778..c6e10be 100644 --- a/oswin_tempest_plugin/tests/scenario/test_cluster.py +++ b/oswin_tempest_plugin/tests/scenario/test_cluster.py @@ -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. diff --git a/oswin_tempest_plugin/tests/scenario/test_disks.py b/oswin_tempest_plugin/tests/scenario/test_disks.py index 9108b98..d78b992 100644 --- a/oswin_tempest_plugin/tests/scenario/test_disks.py +++ b/oswin_tempest_plugin/tests/scenario/test_disks.py @@ -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 diff --git a/oswin_tempest_plugin/tests/scenario/test_qos.py b/oswin_tempest_plugin/tests/scenario/test_qos.py index 6748b7e..0d39c9a 100644 --- a/oswin_tempest_plugin/tests/scenario/test_qos.py +++ b/oswin_tempest_plugin/tests/scenario/test_qos.py @@ -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. diff --git a/oswin_tempest_plugin/tests/scenario/test_remotefx.py b/oswin_tempest_plugin/tests/scenario/test_remotefx.py index 5834d21..dbb39a6 100644 --- a/oswin_tempest_plugin/tests/scenario/test_remotefx.py +++ b/oswin_tempest_plugin/tests/scenario/test_remotefx.py @@ -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. diff --git a/oswin_tempest_plugin/tests/scenario/test_secure_boot.py b/oswin_tempest_plugin/tests/scenario/test_secure_boot.py index 5199410..54b319b 100644 --- a/oswin_tempest_plugin/tests/scenario/test_secure_boot.py +++ b/oswin_tempest_plugin/tests/scenario/test_secure_boot.py @@ -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 diff --git a/oswin_tempest_plugin/tests/scenario/test_vnuma.py b/oswin_tempest_plugin/tests/scenario/test_vnuma.py index e665dca..d7e0ddd 100644 --- a/oswin_tempest_plugin/tests/scenario/test_vnuma.py +++ b/oswin_tempest_plugin/tests/scenario/test_vnuma.py @@ -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.