Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH V2] oeqa/decorators: Fixed a problem with tests having the same names.
@ 2015-09-04 13:48 Lucian Musat
  2015-09-04 16:38 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Lucian Musat @ 2015-09-04 13:48 UTC (permalink / raw)
  To: openembedded-core

When two or more tests had the same name but different classes then
the decorator log whould have the output all wrong. This was because
a comparison which was made only between method names but now it
compares classes too.

YOCTO #8029

Signed-off-by: Lucian Musat <george.l.musat@intel.com>
---
 meta/lib/oeqa/utils/decorators.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index b9fc76c..ff84541 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -116,13 +116,14 @@ def LogResults(original_class):
         orig_method(self, result, *args, **kws)
         passed = True
         testMethod = getattr(self, self._testMethodName)
-
         #if test case is decorated then use it's number, else use it's name
         try:
             test_case = testMethod.test_case
         except AttributeError:
             test_case = self._testMethodName
 
+        class_name = str(testMethod.im_class).split("'")[1]
+
         #create custom logging level for filtering.
         custom_log_level = 100
         logging.addLevelName(custom_log_level, 'RESULTS')
@@ -143,18 +144,19 @@ def LogResults(original_class):
         local_log = logging.getLogger(caller)
 
         #check status of tests and record it
+
         for (name, msg) in result.errors:
-            if self._testMethodName == str(name).split(' ')[0]:
+            if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
                 local_log.results("Testcase "+str(test_case)+": ERROR")
                 local_log.results("Testcase "+str(test_case)+":\n"+msg)
                 passed = False
         for (name, msg) in result.failures:
-            if self._testMethodName == str(name).split(' ')[0]:
+            if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
                 local_log.results("Testcase "+str(test_case)+": FAILED")
                 local_log.results("Testcase "+str(test_case)+":\n"+msg)
                 passed = False
         for (name, msg) in result.skipped:
-            if self._testMethodName == str(name).split(' ')[0]:
+            if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
                 local_log.results("Testcase "+str(test_case)+": SKIPPED")
                 passed = False
         if passed:
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-04 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 13:48 [PATCH V2] oeqa/decorators: Fixed a problem with tests having the same names Lucian Musat
2015-09-04 16:38 ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox