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

[libvirt] [test-API 10/10] Destroy the codes to skip case steps.



---
 libvirt-test-api |   13 ++++-------
 src/generator.py |   57 +++++++++--------------------------------------------
 2 files changed, 15 insertions(+), 55 deletions(-)

diff --git a/libvirt-test-api b/libvirt-test-api
index b7c2468..7343b6b 100644
--- a/libvirt-test-api
+++ b/libvirt-test-api
@@ -68,11 +68,10 @@ class Main(object):
     """ The class provides methods to run a new test and manage
         testing log and records
     """
-    def __init__(self, casefile, logxml, loglevel, bugstxt):
+    def __init__(self, casefile, logxml, loglevel):
         self.casefile = casefile
         self.logxml = logxml
         self.loglevel = loglevel
-        self.bugstxt = bugstxt
 
     def run(self, activities_options_list=None):
         """ Run a test instance """
@@ -150,7 +149,6 @@ class Main(object):
                                            testid,
                                            log_xml_parser,
                                            lockfile,
-                                           self.bugstxt,
                                            self.loglevel)
                         )
 
@@ -307,7 +305,6 @@ if __name__ == "__main__":
 
     casefile = "./case.conf"
     logxml = "./log.xml"
-    bugstxt = "./BUGSKIP"
     loglevel = 0
 
     try:
@@ -351,7 +348,7 @@ if __name__ == "__main__":
                 usage()
                 sys.exit(1)
 
-            main = Main(casefile, logxml, loglevel, bugstxt)
+            main = Main(casefile, logxml, loglevel)
             main.remove_log(testrunid, testid)
             sys.exit(0)
         if o == "-m" or o == "--merge":
@@ -359,7 +356,7 @@ if __name__ == "__main__":
                 logxml_one = args[0]
                 logxml_two = args[1]
 
-                main = Main(casefile, logxml_one, loglevel, bugstxt)
+                main = Main(casefile, logxml_one, loglevel)
                 main.merge_logxmls(logxml_two)
                 sys.exit(0)
             else:
@@ -375,14 +372,14 @@ if __name__ == "__main__":
                 for testid in args[1:]:
                     testid = int(testid)
                     testid_list.append(testid)
-                main = Main(casefile, logxml, loglevel, bugstxt)
+                main = Main(casefile, logxml, loglevel)
                 main.rerun(testrunid, testid_list)
                 sys.exit(0)
 
     # Add root path of libvirt-test-API into sys.path
     append_path()
 
-    main = Main(casefile, logxml, loglevel, bugstxt)
+    main = Main(casefile, logxml, loglevel)
     if main.run():
         sys.exit(1)
     sys.exit(0)
diff --git a/src/generator.py b/src/generator.py
index 4d358d7..432e774 100644
--- a/src/generator.py
+++ b/src/generator.py
@@ -43,13 +43,12 @@ class FuncGen(object):
                  activity, logfile,
                  testrunid, testid,
                  log_xml_parser, lockfile,
-                 bugstxt, loglevel):
+                 loglevel):
         self.cases_func_ref_dict = cases_func_ref_dict
         self.logfile = logfile
         self.testrunid = testrunid
         self.testid = testid
         self.lockfile = lockfile
-        self.bugstxt = bugstxt
         self.loglevel = loglevel
         self.testcase_number = 0
 
@@ -84,31 +83,6 @@ class FuncGen(object):
         retflag = self.generator()
         return retflag
 
-    def bug_check(self, mod_func_name):
-        """ Check if there was already a bug in bugzilla assocaited with
-            specific testcase
-        """
-        exsited_bug = []
-        bugstxt = open(self.bugstxt, "r")
-        linelist = bugstxt.readlines()
-
-        if len(linelist) == 0:
-            bugstxt.close()
-            return exsited_bug
-
-        for line in linelist:
-            if line.startswith('#'):
-                continue
-            else:
-                casename = line.split(' ', 1)[0]
-                if casename == "casename:" + mod_func_name:
-                    exsited_bug.append(line)
-                else:
-                    pass
-
-        bugstxt.close()
-        return exsited_bug
-
     def generator(self):
         """ Run each test case with the corresponding arguments and
             add log object into the dictionary of arguments
@@ -161,27 +135,16 @@ class FuncGen(object):
                     if case_ref_name != 'sleep':
                         case_params['logger'] = case_logger
 
-                    existed_bug_list = self.bug_check(pkg_casename)
-
-                    if len(existed_bug_list) == 0:
-                        if case_ref_name == 'sleep':
-                            sleepsecs = case_params['sleep']
-                            case_logger.info("sleep %s seconds" % sleepsecs)
-                            time.sleep(int(sleepsecs))
-                            ret = 0
-                        else:
-                            ret = self.cases_func_ref_dict[case_ref_name](case_params)
-                            if cleanoper:
-                                clean_ret = ret
-                                ret = 0
+                    if case_ref_name == 'sleep':
+                        sleepsecs = case_params['sleep']
+                        case_logger.info("sleep %s seconds" % sleepsecs)
+                        time.sleep(int(sleepsecs))
+                        ret = 0
                     else:
-                        case_logger.info("about the testcase , bug existed:")
-                        for existed_bug in existed_bug_list:
-                            case_logger.info("%s" % existed_bug)
-
-                        ret = 100
-                        self.fmt.print_end(pkg_casename, ret, env_logger)
-                        continue
+                        ret = self.cases_func_ref_dict[case_ref_name](case_params)
+                        if cleanoper:
+                            clean_ret = ret
+                            ret = 0
                 except Exception, e:
                     case_logger.error(traceback.format_exc())
                     continue
-- 
1.7.7.3


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