]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/core/utils/test.py: Add functions to get module path
authorMariano Lopez <mariano.lopez@linux.intel.com>
Mon, 9 Jan 2017 14:42:48 +0000 (14:42 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Jan 2017 12:03:57 +0000 (12:03 +0000)
This will add functions to get module file path from a test
case or a complete suite.

[YOCTO #10234]

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
meta/lib/oeqa/core/utils/test.py

index 820b9976ab21616557664085edb6922bfd86735f..88d176552e11eb27baaeef3fd58ee724a82170a7 100644 (file)
@@ -2,6 +2,7 @@
 # Released under the MIT license (see COPYING.MIT)
 
 import os
+import inspect
 import unittest
 
 def getSuiteCases(suite):
@@ -46,6 +47,12 @@ def getSuiteCasesIDs(suite):
     """
     return getSuiteCasesInfo(suite, getCaseID)
 
+def getSuiteCasesFiles(suite):
+    """
+        Returns test case files paths from suite.
+    """
+    return getSuiteCasesInfo(suite, getCaseFile)
+
 def getCaseModule(test_case):
     """
         Returns test case module name.
@@ -64,6 +71,12 @@ def getCaseID(test_case):
     """
     return test_case.id()
 
+def getCaseFile(test_case):
+    """
+        Returns test case file path.
+    """
+    return inspect.getsourcefile(test_case.__class__)
+
 def getCaseMethod(test_case):
     """
         Returns test case method name.