]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/core/loader.py: Give meaningful error when failed to load classes
authorMariano Lopez <mariano.lopez@linux.intel.com>
Mon, 27 Feb 2017 07:45:00 +0000 (07:45 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Mar 2017 15:50:18 +0000 (15:50 +0000)
With this we get the class that is actually having the problem,
not just a TypeError with an unknown class causing the error.

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/core/loader.py

index a38032590dedde2004bc38042d427af35bfb571e..b9ba9235af88e948dcc50c2dcbc56cb133e4eaa5 100644 (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'):