← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~wesley-wiedenmeier/cloud-init:integration-testing-mro into cloud-init:master

 

Wesley Wiedenmeier has proposed merging ~wesley-wiedenmeier/cloud-init:integration-testing-mro into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~wesley-wiedenmeier/cloud-init/+git/cloud-init/+merge/320234

Integration Testing: improve testcase subclassing

 - Use inspect.getmro(mod) rather than mod.__bases__ to test if a potential
   testcase class inherits from CloudTestCase
 - This allows testcases to be based on CloudTestCase indirectly, adding
   greater flexibility to the structure of test classes

-- 
Your team cloud init development team is requested to review the proposed merge of ~wesley-wiedenmeier/cloud-init:integration-testing-mro into cloud-init:master.
diff --git a/tests/cloud_tests/testcases/__init__.py b/tests/cloud_tests/testcases/__init__.py
index 182c090..a1d86d4 100644
--- a/tests/cloud_tests/testcases/__init__.py
+++ b/tests/cloud_tests/testcases/__init__.py
@@ -21,7 +21,7 @@ def discover_tests(test_name):
         raise ValueError('no test verifier found at: {}'.format(testmod_name))
 
     return [mod for name, mod in inspect.getmembers(testmod)
-            if inspect.isclass(mod) and base_test in mod.__bases__ and
+            if inspect.isclass(mod) and base_test in inspect.getmro(mod) and
             getattr(mod, '__test__', True)]
 
 

Follow ups