1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

oeqa/core/loader.py: Give meaningful error when failed to load classes

With this we get the class that is actually having the problem,
not just a TypeError with an unknown class causing the error.

(From OE-Core rev: d6ff4891376417504018af27e8e729a412feeeea)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mariano Lopez
2017-02-27 07:45:00 +00:00
committed by Richard Purdie
parent 21eb3e07c6
commit 9f8748c59f
+4 -4
View File
@@ -171,11 +171,11 @@ class OETestLoader(unittest.TestLoader):
"""
if issubclass(testCaseClass, unittest.suite.TestSuite):
raise TypeError("Test cases should not be derived from TestSuite." \
" Maybe you meant to derive from TestCase?")
" Maybe you meant to derive %s from TestCase?" \
% testCaseClass.__name__)
if not issubclass(testCaseClass, self.caseClass):
raise TypeError("Test cases need to be derived from %s" % \
self.caseClass.__name__)
raise TypeError("Test %s is not derived from %s" % \
(testCaseClass.__name__, self.caseClass.__name__))
testCaseNames = self.getTestCaseNames(testCaseClass)
if not testCaseNames and hasattr(testCaseClass, 'runTest'):