Browse Source

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
Claudiu Belu 1 year ago
parent
commit
ab50a17aff

+ 3
- 3
oswin_tempest_plugin/tests/scenario/test_cluster.py View File

@@ -29,10 +29,10 @@ CONF = config.CONF
29 29
 LOG = logging.getLogger(__name__)
30 30
 
31 31
 
32
-class HyperVClusterTest(test_base.TestBase,
33
-                        migrate._MigrateMixin,
32
+class HyperVClusterTest(migrate._MigrateMixin,
34 33
                         migrate._LiveMigrateMixin,
35
-                        resize._ResizeMixin):
34
+                        resize._ResizeMixin,
35
+                        test_base.TestBase):
36 36
 
37 37
     """The test suite for the Hyper-V Cluster.
38 38
 

+ 3
- 3
oswin_tempest_plugin/tests/scenario/test_disks.py View File

@@ -62,7 +62,7 @@ class _BaseDiskTestMixin(migrate._MigrateMixin,
62 62
         self._check_resize(flavor, new_flavor['id'], expected_fail=True)
63 63
 
64 64
 
65
-class VhdDiskTest(test_base.TestBase, _BaseDiskTestMixin):
65
+class VhdDiskTest(_BaseDiskTestMixin, test_base.TestBase):
66 66
 
67 67
     _IMAGE_REF = CONF.hyperv.vhd_image_ref
68 68
     _CONF_OPTION_NAME = 'hyperv.vhd_image_ref'
@@ -71,14 +71,14 @@ class VhdDiskTest(test_base.TestBase, _BaseDiskTestMixin):
71 71
     # TODO(claudiub): validate that the images really are VHD / VHDX.
72 72
 
73 73
 
74
-class VhdxDiskTest(test_base.TestBase, _BaseDiskTestMixin):
74
+class VhdxDiskTest(_BaseDiskTestMixin, test_base.TestBase):
75 75
 
76 76
     _IMAGE_REF = CONF.hyperv.vhdx_image_ref
77 77
     _CONF_OPTION_NAME = 'hyperv.vhdx_image_ref'
78 78
     _FLAVOR_SUFFIX = 'vhdx'
79 79
 
80 80
 
81
-class Generation2DiskTest(test_base.TestBase, _BaseDiskTestMixin):
81
+class Generation2DiskTest(_BaseDiskTestMixin, test_base.TestBase):
82 82
 
83 83
     # Generation 2 VMs have been introduced in Windows / Hyper-V Server 2012 R2
84 84
     _MIN_HYPERV_VERSION = 6003

+ 2
- 2
oswin_tempest_plugin/tests/scenario/test_qos.py View File

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

+ 2
- 2
oswin_tempest_plugin/tests/scenario/test_remotefx.py View File

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

+ 2
- 2
oswin_tempest_plugin/tests/scenario/test_secure_boot.py View File

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

+ 3
- 3
oswin_tempest_plugin/tests/scenario/test_vnuma.py View File

@@ -24,12 +24,12 @@ from oswin_tempest_plugin.tests import test_base
24 24
 CONF = config.CONF
25 25
 
26 26
 
27
-class HyperVvNumaTestCase(test_base.TestBase,
28
-                          migrate._MigrateMixin,
27
+class HyperVvNumaTestCase(migrate._MigrateMixin,
29 28
                           migrate._LiveMigrateMixin,
30 29
                           optional_feature._OptionalFeatureMixin,
31 30
                           resize._ResizeMixin,
32
-                          resize._ResizeNegativeMixin):
31
+                          resize._ResizeNegativeMixin,
32
+                          test_base.TestBase):
33 33
     """Hyper-V vNUMA test suite.
34 34
 
35 35
     This test suite will spawn instances requiring NUMA placement.

Loading…
Cancel
Save