]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/core/loader.py: Fix _make_failed_test for python >= 3.4.4
authorAníbal Limón <anibal.limon@linux.intel.com>
Thu, 15 Jun 2017 22:09:49 +0000 (17:09 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 23 Jun 2017 10:43:37 +0000 (11:43 +0100)
Python unittest change the signature of the _make_failed_test
after python 3.4.4 don't pass the method name.

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/core/loader.py

index 229f094b381a8cbfa9be538a2dc2a09808b39abd..80e3d2800cdee1988fe08da89a35315d0d248cf0 100644 (file)
@@ -12,15 +12,19 @@ from oeqa.core.case import OETestCase
 from oeqa.core.decorator import decoratorClasses, OETestDecorator, \
         OETestFilter, OETestDiscover
 
-def _make_failed_test(classname, methodname, exception, suiteClass):
-    """
-        When loading tests, the unittest framework stores any exceptions and
-        displays them only when the 'run' method is called.
-
-        For our purposes, it is better to raise the exceptions in the loading
-        step rather than waiting to run the test suite.
-    """
-    raise exception
+if sys.version_info >= (3,4,4):
+    def _make_failed_test(classname, methodname, exception, suiteClass):
+        """
+            When loading tests, the unittest framework stores any exceptions and
+            displays them only when the 'run' method is called.
+
+            For our purposes, it is better to raise the exceptions in the loading
+            step rather than waiting to run the test suite.
+        """
+        raise exception
+else:
+    def _make_failed_test(classname, exception, suiteClass):
+        raise exception
 unittest.loader._make_failed_test = _make_failed_test
 
 def _find_duplicated_modules(suite, directory):