summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/oetest.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 70db119e39..8ad3715aec 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -264,6 +264,22 @@ class TestContext(object):
264 264
265 return testslist 265 return testslist
266 266
267 def getTests(self, test):
268 '''Return all individual tests executed when running the suite.'''
269 # Unfortunately unittest does not have an API for this, so we have
270 # to rely on implementation details. This only needs to work
271 # for TestSuite containing TestCase.
272 method = getattr(test, '_testMethodName', None)
273 if method:
274 # leaf case: a TestCase
275 yield test
276 else:
277 # Look into TestSuite.
278 tests = getattr(test, '_tests', [])
279 for t1 in tests:
280 for t2 in self.getTests(t1):
281 yield t2
282
267 def loadTests(self): 283 def loadTests(self):
268 setattr(oeTest, "tc", self) 284 setattr(oeTest, "tc", self)
269 285
@@ -272,36 +288,20 @@ class TestContext(object):
272 suites = [testloader.loadTestsFromName(name) for name in self.testslist] 288 suites = [testloader.loadTestsFromName(name) for name in self.testslist]
273 suites = filterByTagExp(suites, getattr(self, "tagexp", None)) 289 suites = filterByTagExp(suites, getattr(self, "tagexp", None))
274 290
275 def getTests(test):
276 '''Return all individual tests executed when running the suite.'''
277 # Unfortunately unittest does not have an API for this, so we have
278 # to rely on implementation details. This only needs to work
279 # for TestSuite containing TestCase.
280 method = getattr(test, '_testMethodName', None)
281 if method:
282 # leaf case: a TestCase
283 yield test
284 else:
285 # Look into TestSuite.
286 tests = getattr(test, '_tests', [])
287 for t1 in tests:
288 for t2 in getTests(t1):
289 yield t2
290
291 # Determine dependencies between suites by looking for @skipUnlessPassed 291 # Determine dependencies between suites by looking for @skipUnlessPassed
292 # method annotations. Suite A depends on suite B if any method in A 292 # method annotations. Suite A depends on suite B if any method in A
293 # depends on a method on B. 293 # depends on a method on B.
294 for suite in suites: 294 for suite in suites:
295 suite.dependencies = [] 295 suite.dependencies = []
296 suite.depth = 0 296 suite.depth = 0
297 for test in getTests(suite): 297 for test in self.getTests(suite):
298 methodname = getattr(test, '_testMethodName', None) 298 methodname = getattr(test, '_testMethodName', None)
299 if methodname: 299 if methodname:
300 method = getattr(test, methodname) 300 method = getattr(test, methodname)
301 depends_on = getattr(method, '_depends_on', None) 301 depends_on = getattr(method, '_depends_on', None)
302 if depends_on: 302 if depends_on:
303 for dep_suite in suites: 303 for dep_suite in suites:
304 if depends_on in [getattr(t, '_testMethodName', None) for t in getTests(dep_suite)]: 304 if depends_on in [getattr(t, '_testMethodName', None) for t in self.getTests(dep_suite)]:
305 if dep_suite not in suite.dependencies and \ 305 if dep_suite not in suite.dependencies and \
306 dep_suite is not suite: 306 dep_suite is not suite:
307 suite.dependencies.append(dep_suite) 307 suite.dependencies.append(dep_suite)