diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2009-01-05 23:55:09 +0100 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2009-01-05 23:55:09 +0100 |
| commit | 0ceda3985fa1b3c3bcfa7cc86e3a5a1ebcd9828c (patch) | |
| tree | 92ad2439aefc97f39a05f1d085f86f86022f9ab4 /addons/base_module_quality/base_module_quality.py | |
| parent | c5923d87f2b087e54b759c920cdbea041e8ab3ba (diff) | |
| parent | aef3884e59c6b1aec0e0f127e3e6c1969f4289a9 (diff) | |
merge
bzr revid: fp@tinyerp.com-20090105225509-ovzgto6jz2ihuss2
Diffstat (limited to 'addons/base_module_quality/base_module_quality.py')
| -rw-r--r-- | addons/base_module_quality/base_module_quality.py | 73 |
1 files changed, 21 insertions, 52 deletions
diff --git a/addons/base_module_quality/base_module_quality.py b/addons/base_module_quality/base_module_quality.py index 0564d7c9066..8ded5d15005 100644 --- a/addons/base_module_quality/base_module_quality.py +++ b/addons/base_module_quality/base_module_quality.py @@ -28,31 +28,18 @@ class abstract_quality_check(object): This Class provide... ''' -# #This float have to store the rating of the module. -# #Used to compute the final score (average of all scores). -# score = 0.0 -# -# #This char have to store the result. -# #Used to display the result of the test. -# result = "" -# -# #This char have to store the result with more details. -# #Used to provide more details if necessary. -# result_details = "" -# -# #This bool defines if the test can be run only if the module is installed. -# #True => the module have to be installed. -# #False => the module can be uninstalled. -# bool_installed_only = True - def __init__(self): ''' this method should initialize the var ''' #This float have to store the rating of the module. #Used to compute the final score (average of all scores). + #0 <= self.score <= 1 self.score = 0.0 + #This char have to store the name of the test. + self.name = "" + #This char have to store the result. #Used to display the result of the test. self.result = "" @@ -66,13 +53,13 @@ class abstract_quality_check(object): #False => the module can be uninstalled. self.bool_installed_only = True - #This variable is use to make result of test should have more weight (Some tests are more critical than others) - self.ponderation = 0.0 + self.ponderation = 1.0 #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. self.tests = [] self.list_folders = os.listdir(config['addons_path']+'/base_module_quality/') for item in self.list_folders: @@ -86,11 +73,11 @@ class abstract_quality_check(object): self.tests.append(x3) # raise 'Not Implemented' - def run_test(self, cr, uid, module_path="", module_state=""): + def run_test(self, cr, uid, module_path=""): ''' this method should do the test and fill the score, result and result_details var ''' -# raise 'Not Implemented' + raise 'Not Implemented' def get_objects(self, cr, uid, module): # This function returns all object of the given module.. @@ -114,40 +101,22 @@ class abstract_quality_check(object): result_ids[obj] = ids return result_ids - def format_table(self, test='', header=[], data_list=[]): - res_format = {} - if test=='method': - detail = "" - detail += "\n===Method Test===\n" - res_format['detail'] = detail - if not data_list[2]: - detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') % (header[0].ljust(40), header[1].ljust(16), header[2].ljust(20), header[3].ljust(16)) - for res in data_list[1]: - detail += ('\n|-\n| %s \n| %s \n| %s \n| %s ') % (res, data_list[1][res][0], data_list[1][res][1], data_list[1][res][2]) - res_format['detail'] = detail + '\n|}' - res_format['summary'] = data_list[0] - elif test=='pylint': - res_format['summary'] = data_list[0] - res_format['detail'] = data_list[1] - elif test=='speed': - detail = "" - detail += "\n===Speed Test===\n" - res_format['detail'] = detail - if not data_list[2]: - detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s') % (header[0].ljust(40), header[1].ljust(10), header[2].ljust(10), header[3].ljust(10), header[4].ljust(10), header[5].ljust(20)) - for data in data_list[1]: - detail += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (data[0], data[1], data[2], data[3], data[4], data[5]) - res_format['detail'] = detail + '\n|}\n' - res_format['summary'] = data_list[0] - elif test=='terp': - res_format['summary'] = data_list[0] - res_format['detail'] = data_list[1] - return res_format + def format_table(self, header=[], data_list=[]): + detail = "" + if header[0]=='method': + detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') % (header[1].ljust(40), header[2].ljust(16), header[3].ljust(20), header[4].ljust(16)) + for res in data_list[0]: + detail += ('\n|-\n| %s \n| %s \n| %s \n| %s ') % (res, data_list[0][res][0], data_list[0][res][1], data_list[0][res][2]) + detail = detail + '\n|}' + elif header[0]=='speed': + detail += ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n! %-10s \n! %-10s \n! %-10s \n! %-20s') % (header[1].ljust(40), header[2].ljust(10), header[3].ljust(10), header[4].ljust(10), header[5].ljust(10), header[6].ljust(20)) + for data in data_list[0]: + detail += ('\n|-\n| %s \n| %s \n| %s \n| %s \n| %s \n| %s ') % (data[0], data[1], data[2], data[3], data[4], data[5]) + detail = detail + '\n|}\n' + return detail def add_quatation(self, x, y): return x/y - - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
