[PATCH test-API 1/2] Add root path of test-API into sys.path list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    *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.
---
 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)
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]