Commit 0ed74510 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

CodingStyleTestCase: output errors for all business templates in test_rebuild_business_template.

parent 6a0c55f0
...@@ -136,6 +136,8 @@ class CodingStyleTestCase(ERP5TypeTestCase): ...@@ -136,6 +136,8 @@ class CodingStyleTestCase(ERP5TypeTestCase):
""" """
self.maxDiff = None self.maxDiff = None
template_tool = self.portal.portal_templates template_tool = self.portal.portal_templates
diff_line_list = []
diff_files = []
for bt_title in self.getTestedBusinessTemplateList(): for bt_title in self.getTestedBusinessTemplateList():
bt = template_tool.getInstalledBusinessTemplate(bt_title, strict=True) bt = template_tool.getInstalledBusinessTemplate(bt_title, strict=True)
# run migrations on the business template, except for the BT used to # run migrations on the business template, except for the BT used to
...@@ -158,7 +160,6 @@ class CodingStyleTestCase(ERP5TypeTestCase): ...@@ -158,7 +160,6 @@ class CodingStyleTestCase(ERP5TypeTestCase):
p.strip() for p in self.rebuild_business_template_ignored_path.splitlines() p.strip() for p in self.rebuild_business_template_ignored_path.splitlines()
if p and not p.strip().startswith("#")} if p and not p.strip().startswith("#")}
diff_line_list = []
def get_difference(path, has_old=True, has_new=True): def get_difference(path, has_old=True, has_new=True):
old = ( old = (
os.path.join(bt_base_path, path) os.path.join(bt_base_path, path)
...@@ -214,13 +215,14 @@ class CodingStyleTestCase(ERP5TypeTestCase): ...@@ -214,13 +215,14 @@ class CodingStyleTestCase(ERP5TypeTestCase):
for diff in get_differences(sub_dcmp, os.path.join(base, sub_path)): for diff in get_differences(sub_dcmp, os.path.join(base, sub_path)):
yield diff yield diff
diff_files = list(get_differences(filecmp.dircmp(bt_dir, export_dir), bt_local_path)) diff_files.extend(list(get_differences(filecmp.dircmp(bt_dir, export_dir), bt_local_path)))
# dump a diff in log directory, to help debugging
from Products.ERP5Type.tests.runUnitTest import log_directory # dump a diff in log directory, to help debugging
if log_directory and diff_line_list: from Products.ERP5Type.tests.runUnitTest import log_directory
with open(os.path.join(log_directory, '%s.diff' % self.id()), 'w') as f: if log_directory and diff_line_list:
f.writelines(diff_line_list) with open(os.path.join(log_directory, '%s.diff' % self.id()), 'w') as f:
self.assertEqual(diff_files, []) f.writelines(diff_line_list)
self.assertEqual(diff_files, [])
def test_run_upgrader(self): def test_run_upgrader(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment