On 2012年03月29日 19:38, Guannan Ren wrote:
*libvirt-test-api.py before running testcases, we check whether
the absolute root path of the testsuit is in sys.path. If not,
add it.
ACK with reorgnize the sentence like:
libvirt-test-api.py: Check whether the absolute path of testsuit is
in sys.path, add it if not.
As the original sentence sounds like we already do like that.
---
libvirt-test-api.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/libvirt-test-api.py b/libvirt-test-api.py
index 8d7d811..f399672 100644
--- a/libvirt-test-api.py
+++ b/libvirt-test-api.py
@@ -50,6 +50,13 @@ def usage():
\n python libvirt-test-api.py -f TEST.XML \
-r TESTRUNID TESTID ..."
+def append_path():
+ """Append root path of package"""
+ pwd = os.getcwd()
+ if pwd in sys.path:
+ pass
+ else:
+ sys.path.append(pwd)
class LibvirtTestAPI(object):
""" The class provides methods to run a new test and manage
@@ -331,6 +338,9 @@ if __name__ == "__main__":
libvirt_test_api.rerun(testrunid, testid_list)
sys.exit(0)
+ # Add root path of libvirt-test-API into sys.path
+ append_path()
+
libvirt_test_api = LibvirtTestAPI(casefile, logxml, loglevel, bugstxt)
if libvirt_test_api.run():
sys.exit(1)