From 78d2de2600f3d383edffacb6c0b213b8d8200817 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 7 Jan 2009 19:53:15 +0530 Subject: Corrected terp test on Quality Module bzr revid: jvo@tinyerp.com-20090107142315-xb8qq0u9coexf04m --- addons/base_module_quality/method_test/method_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/base_module_quality/method_test/method_test.py') diff --git a/addons/base_module_quality/method_test/method_test.py b/addons/base_module_quality/method_test/method_test.py index 8ca77b996f5..58c536e9e9c 100644 --- a/addons/base_module_quality/method_test/method_test.py +++ b/addons/base_module_quality/method_test/method_test.py @@ -76,7 +76,7 @@ class quality_test(base_module_quality.abstract_quality_check): def get_result(self): summary = """ -This test checks if the module classes are raising exception when calling basic methods or no. +This test checks if the module classes are raising exception when calling basic methods or not. """ return summary -- cgit v1.2.3 From 5b6bcfb55917f2755e4998ed5f684a1b19f8d872 Mon Sep 17 00:00:00 2001 From: qdp Date: Thu, 8 Jan 2009 09:49:26 +0100 Subject: *imrpovements bzr revid: qdp@tinyerp.com-20090108084926-n4dxtv1bczx9id1t --- .../base_module_quality/method_test/method_test.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'addons/base_module_quality/method_test/method_test.py') diff --git a/addons/base_module_quality/method_test/method_test.py b/addons/base_module_quality/method_test/method_test.py index 58c536e9e9c..b9c52279875 100644 --- a/addons/base_module_quality/method_test/method_test.py +++ b/addons/base_module_quality/method_test/method_test.py @@ -34,8 +34,6 @@ class quality_test(base_module_quality.abstract_quality_check): self.name = _("Method Test") self.bool_installed_only = True self.ponderation = 1.0 - self.result_det = {} - self.data_list = [] return None def run_test(self, cr, uid, module_path): @@ -44,8 +42,9 @@ class quality_test(base_module_quality.abstract_quality_check): obj_list = self.get_objects(cr, uid, module_name) ok_count = 0 ex_count = 0 + result_dict = {} for obj in obj_list: - temp = [] + temp = [obj] try: res = pool.get(obj).search(cr, uid, []) temp.append('Ok') @@ -67,11 +66,10 @@ class quality_test(base_module_quality.abstract_quality_check): except: temp.append('Exception') ex_count += 1 - self.result_det[obj] = temp - self.data_list.append(self.result_det) + result_dict[obj] = temp 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() + self.result_details = self.get_result_details(result_dict) return None def get_result(self): @@ -80,15 +78,11 @@ This test checks if the module classes are raising exception when calling basic """ return summary - def get_result_details(self): - header_list = [] - header_list.append('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ') - header_list.append('\n|-\n| %s \n| %s \n| %s \n| %s ') - header_view = ['Object Name', 'search()', 'fields_view_get', 'read'] - self.data_list.append(header_view) + def get_result_details(self, dict): + header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ', [_('Object Name'), 'search()', 'fields_view_get()', 'read()']) detail = "" if not self.error: - detail += self.format_table(header=header_list, data_list=self.data_list) + detail += self.format_table(header, dict) return detail # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- cgit v1.2.3 From 8a06bea953c16c90d4bef269638b5d6b467b89a9 Mon Sep 17 00:00:00 2001 From: qdp Date: Thu, 8 Jan 2009 14:03:20 +0100 Subject: base_module_quality improvements: *added note field *improved transability *improved output *cleaned *modified format_table method bzr revid: qdp@tinyerp.com-20090108130320-ypcc4jxbx51jv1ra --- .../base_module_quality/method_test/method_test.py | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'addons/base_module_quality/method_test/method_test.py') diff --git a/addons/base_module_quality/method_test/method_test.py b/addons/base_module_quality/method_test/method_test.py index b9c52279875..1abaa288e86 100644 --- a/addons/base_module_quality/method_test/method_test.py +++ b/addons/base_module_quality/method_test/method_test.py @@ -32,6 +32,9 @@ class quality_test(base_module_quality.abstract_quality_check): def __init__(self): super(quality_test, self).__init__() self.name = _("Method Test") + self.note = _(""" +This test checks if the module classes are raising exception when calling basic methods or not. +""") self.bool_installed_only = True self.ponderation = 1.0 return None @@ -47,38 +50,32 @@ class quality_test(base_module_quality.abstract_quality_check): temp = [obj] try: res = pool.get(obj).search(cr, uid, []) - temp.append('Ok') + temp.append(_('Ok')) ok_count += 1 except: - temp.append('Exception') + temp.append(_('Exception')) ex_count += 1 try: res1 = pool.get(obj).fields_view_get(cr, uid,) - temp.append('Ok') + temp.append(_('Ok')) ok_count += 1 except: - temp.append('Exception') + temp.append(_('Exception')) ex_count += 1 try: res2 = pool.get(obj).read(cr, uid, []) - temp.append('Ok') + temp.append(_('Ok')) ok_count += 1 except: - temp.append('Exception') + temp.append(_('Exception')) ex_count += 1 result_dict[obj] = temp 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(result_dict) + self.result = self.get_result(result_dict) return None - def get_result(self): - summary = """ -This test checks if the module classes are raising exception when calling basic methods or not. -""" - return summary - def get_result_details(self, dict): + def get_result(self, dict): header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-16s \n! %-20s \n! %-16s ', [_('Object Name'), 'search()', 'fields_view_get()', 'read()']) detail = "" if not self.error: -- cgit v1.2.3