small changes
authormra (Open ERP) <mra@tinyerp.com>
Wed, 7 Jan 2009 09:33:01 +0000 (15:03 +0530)
committermra (Open ERP) <mra@tinyerp.com>
Wed, 7 Jan 2009 09:33:01 +0000 (15:03 +0530)
bzr revid: mra@tinyerp.com-20090107093301-riilvjtanc4ibqdq

addons/base_module_quality/base_module_quality.py
addons/base_module_quality/method_test/method_test.py
addons/base_module_quality/pylint_test/pylint_test.py
addons/base_module_quality/speed_test/speed_test.py
addons/base_module_quality/terp_test/terp_test.py

index 8ded5d1..21c17e9 100644 (file)
@@ -59,7 +59,7 @@ class abstract_quality_check(object):
         #Specify test got an error on module
         self.error = False
 
-        #The tests have to subscribe itselfs in this list, that contains all the test that have to be performed. 
+        #The tests have to subscribe itselfs in this list, that contains all the test that have to be performed.
         self.tests = []
         self.list_folders = os.listdir(config['addons_path']+'/base_module_quality/')
         for item in self.list_folders:
index ed53a53..5c24430 100644 (file)
@@ -31,6 +31,7 @@ class quality_test(base_module_quality.abstract_quality_check):
 
     def __init__(self):
         super(quality_test, self).__init__()
+        self.name = _("Method Test")
         self.bool_installed_only = True
         self.ponderation = 1.0
         self.result_det = {}
@@ -69,22 +70,17 @@ class quality_test(base_module_quality.abstract_quality_check):
         self.score = (ok_count + ex_count) and float(ok_count)/float(ok_count + ex_count) or 0.0
         self.result = self.get_result()
         self.result_details = self.get_result_details()
-
         return None
 
-
     def get_result(self):
         summary = """
-===Method Test===:
-
 This test checks if the module classes are raising exception when calling basic methods or no.
-
-""" + "Score: " + str(self.score) + "/10\n"
+"""
         return summary
 
     def get_result_details(self):
         header_list = ['method', 'Object Name', 'search()', 'fields_view_get', 'read']
-        detail = "\n===Method Test===\n"
+        detail = ""  #"\n===Method Test===\n"
         if not self.error:
             detail += self.format_table(header=header_list, data_list=[self.result_det])
         return detail
index 04e43db..3c40bad 100644 (file)
@@ -47,6 +47,7 @@ class quality_test(base_module_quality.abstract_quality_check):
 
         n = 0
         score = 0.0
+        self.result += "\nThis test checks if the module satisfies the current coding standard used by OpenERP. \n\n"
         for file in list_files:
             if file.split('.')[-1] == 'py' and not file.endswith('__init__.py') and not file.endswith('__terp__.py'):
                 file_path = os.path.join(module_path, file)
index 45800e0..7ea7d5d 100644 (file)
@@ -35,6 +35,7 @@ class quality_test(base_module_quality.abstract_quality_check):
 
     def __init__(self):
         super(quality_test, self).__init__()
+        self.name = _("Speed Test")
         self.bool_installed_only = True
         self.ponderation = 1.0
         self.listdata = []
@@ -84,29 +85,30 @@ class quality_test(base_module_quality.abstract_quality_check):
                 list = [obj, size, "", "", "", "Warning! Object has no demo data"]
                 self.listdata.append(list)
         self.score = obj_counter and score/obj_counter or 0.0
-        return None
+        self.result = self.get_result()
+        self.result_details = self.get_result_details()
 
-    def get_result(self, cr, uid, module_path, module_state):
-        self.run_test(cr, uid, module_path)
-        if not self.bool_installed_only or module_state=="installed":
-            summary = """
-===Speed Test===:
+        return None
 
+    def get_result(self):
+##        self.run_test(cr, uid, module_path)
+#        if not self.bool_installed_only or module_state=="installed":
+        summary = """
 This test checks the speed of the module.
 
-""" + "Score: " + str(self.score) + "/10\n"
-        else:
-            summary ="""  \n===Speed Test===:
-
-The module has to be installed before running this test.\n\n """
-            header_list = ""
-            self.error = True
+"""
+#        else:
+#            summary ="""  \n===Speed Test===:
+#
+#The module has to be installed before running this test.\n\n """
+#            header_list = ""
+#            self.error = True
         return summary
 
-    def get_result_detail(self):
+    def get_result_details(self):
         header_list = ['speed', 'Object Name', 'Size-Number of Records (S)', '1', 'S/2', 'S', 'Complexity using query']
         detail = ""
-        detail += "\n===Speed Test===\n"
+#        detail += "\n===Speed Test===\n"
         if not self.error:
             detail += self.format_table(header=header_list, data_list=[self.listdata])
         return detail
index 9ee4572..f42b697 100644 (file)
@@ -30,10 +30,11 @@ import re
 class quality_test(base_module_quality.abstract_quality_check):
 
     def __init__(self):
-        '''
-        This test checks the quality of __terp__.py file in the selected module.
-        '''
+#        '''
+#        This test checks the quality of __terp__.py file in the selected module.
+#        '''
         super(quality_test, self).__init__()
+        self.name = _("Terp Test")
         self.bool_installed_only = False
         self.no_terp = False
         self.ponderation = 2
@@ -54,6 +55,9 @@ class quality_test(base_module_quality.abstract_quality_check):
         feel_bad_factor = 0
         if '__terp__.py' not in list_files:
             self.no_terp = True
+        if self.no_terp:
+            self.result += "The module does not contain the __terp__.py file"
+
         terp_file = os.path.join(module_path,'__terp__.py')
         res = eval(tools.file_open(terp_file).read())
 
@@ -79,19 +83,20 @@ class quality_test(base_module_quality.abstract_quality_check):
                 feel_bad_factor += 1
 
         self.score = round((feel_good_factor) / float(feel_good_factor + feel_bad_factor),2)
-        self.result += "__terp__.py : "+ str(self.score) + "/10\n"
+        self.result += "\nThis test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP."
+#        self.result += "__terp__.py : "+ str(self.score) + "/10\n"
         return None
 
     def get_result(self, cr, uid, module_path, module_state):
-        self.run_test(cr, uid, module_path)
-        summary = "\n===TERP Test===:\n"
+#        self.run_test(cr, uid, module_path)
+#        summary = "\n===TERP Test===:\n"
         if self.no_terp:
            summary += """
 The module does not contain the __terp__.py file.\n\n """
-        else:
-            summary += """
-    This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP.
-    """ + "Score: " + str(self.score) + "/10\n"
+#        else:
+#            summary += """
+#    This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP.
+#    """ + "Score: " + str(self.score) + "/10\n"
         return summary
 
     def get_result_details(self):