summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorLucian Musat <george.l.musat@intel.com>2015-09-04 16:48:29 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-06 15:26:22 +0100
commit4925fa08e12bee41788c986ebc213bca4dc49c78 (patch)
tree9480ff41d1d32ce3511fea493982886beaf80d09 /meta/lib/oeqa/utils
parente59b8176d24287dcd93a802224b1249f030981df (diff)
downloadpoky-4925fa08e12bee41788c986ebc213bca4dc49c78.tar.gz
oeqa/decorators: Fixed a problem with tests having the same names.
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] (From OE-Core rev: 2b475f82d13b5c04d0c483d11a7df5e9352caa75) Signed-off-by: Lucian Musat <george.l.musat@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/decorators.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index 769b4fffdd..162a88fb78 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -116,13 +116,14 @@ def LogResults(original_class):
116 orig_method(self, result, *args, **kws) 116 orig_method(self, result, *args, **kws)
117 passed = True 117 passed = True
118 testMethod = getattr(self, self._testMethodName) 118 testMethod = getattr(self, self._testMethodName)
119
120 #if test case is decorated then use it's number, else use it's name 119 #if test case is decorated then use it's number, else use it's name
121 try: 120 try:
122 test_case = testMethod.test_case 121 test_case = testMethod.test_case
123 except AttributeError: 122 except AttributeError:
124 test_case = self._testMethodName 123 test_case = self._testMethodName
125 124
125 class_name = str(testMethod.im_class).split("'")[1]
126
126 #create custom logging level for filtering. 127 #create custom logging level for filtering.
127 custom_log_level = 100 128 custom_log_level = 100
128 logging.addLevelName(custom_log_level, 'RESULTS') 129 logging.addLevelName(custom_log_level, 'RESULTS')
@@ -143,18 +144,19 @@ def LogResults(original_class):
143 local_log = logging.getLogger(caller) 144 local_log = logging.getLogger(caller)
144 145
145 #check status of tests and record it 146 #check status of tests and record it
147
146 for (name, msg) in result.errors: 148 for (name, msg) in result.errors:
147 if self._testMethodName == str(name).split(' ')[0]: 149 if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
148 local_log.results("Testcase "+str(test_case)+": ERROR") 150 local_log.results("Testcase "+str(test_case)+": ERROR")
149 local_log.results("Testcase "+str(test_case)+":\n"+msg) 151 local_log.results("Testcase "+str(test_case)+":\n"+msg)
150 passed = False 152 passed = False
151 for (name, msg) in result.failures: 153 for (name, msg) in result.failures:
152 if self._testMethodName == str(name).split(' ')[0]: 154 if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
153 local_log.results("Testcase "+str(test_case)+": FAILED") 155 local_log.results("Testcase "+str(test_case)+": FAILED")
154 local_log.results("Testcase "+str(test_case)+":\n"+msg) 156 local_log.results("Testcase "+str(test_case)+":\n"+msg)
155 passed = False 157 passed = False
156 for (name, msg) in result.skipped: 158 for (name, msg) in result.skipped:
157 if self._testMethodName == str(name).split(' ')[0]: 159 if (self._testMethodName == str(name).split(' ')[0]) and (class_name in str(name).split(' ')[1]):
158 local_log.results("Testcase "+str(test_case)+": SKIPPED") 160 local_log.results("Testcase "+str(test_case)+": SKIPPED")
159 passed = False 161 passed = False
160 if passed: 162 if passed: