Skip to contentSkip to conversation

oeqa/core/threaded: Don't assume that results exists on logDetails

PATCH New Aníbal Limón 1 participant 3 messages Jun 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 oeqa/core/threaded: Don't assume that results exists on logDetails

---
 meta/lib/oeqa/core/threaded.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/lib/oeqa/core/threaded.py +4 -3
index c6058a3..2cafe03 100644
@@ -185,9 +185,10 @@ class OETestResultThreaded(object):
         self.tc.logger.info(msg)
 
     def logDetails(self):
-        tid = list(self._results)[0]
-        result = self._results[tid]['result']
-        result.logDetails()
+        if list(self._results):
+            tid = list(self._results)[0]
+            result = self._results[tid]['result']
+            result.logDetails()
 
 class _Worker(threading.Thread):
     """Thread executing tasks from a given tasks queue"""
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/3 oeqa/core/loader.py: Fix _make_failed_test for python >= 3.4.4

Python unittest change the signature of the _make_failed_test after python 3.4.4 don't pass the method name.

---
 meta/lib/oeqa/core/loader.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
meta/lib/oeqa/core/loader.py +13 -9
index 229f094..80e3d28 100644
@@ -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):
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/3 oeqa/selftest/context: Reload testlayer_path when meta-selftest isn't added

In reply to Aníbal Limón

When add meta-selftest by the script the testlayer_path needs to be reloaded to avoid None value.

---
 meta/lib/oeqa/selftest/context.py | 1 +
 1 file changed, 1 insertion(+)
meta/lib/oeqa/selftest/context.py +1 -0
index 8c8439b..ca87398 100644
@@ -131,6 +131,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
                     runCmd("bitbake-layers add-layer %s" %meta_selftestdir)
                     # reload data is needed because a meta-selftest layer was add
                     self.tc.td = get_bb_vars()
+                    self.tc.testlayer_path = get_test_layer()
                 else:
                     self.tc.logger.error("could not locate meta-selftest in:\n%s" % meta_selftestdir)
                     raise OEQAPreRun
Signature · 1 line
2.1.4