[OE-core] [PATCH 50/55] oeqa/core/utils/test.py: Add functions to get module path

Aníbal Limón anibal.limon at linux.intel.com
Fri Jan 20 17:10:21 UTC 2017


From: Mariano Lopez <mariano.lopez at linux.intel.com>

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 at linux.intel.com>
---
 meta/lib/oeqa/core/utils/test.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/lib/oeqa/core/utils/test.py b/meta/lib/oeqa/core/utils/test.py
index 820b997..88d1765 100644
--- a/meta/lib/oeqa/core/utils/test.py
+++ b/meta/lib/oeqa/core/utils/test.py
@@ -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.
-- 
2.1.4




More information about the Openembedded-core mailing list