Commit c8002284 authored by Julien Muchembled's avatar Julien Muchembled

Allow projects to reuse testXHTML easily for their own BT.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27652 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c77d34e3
...@@ -48,64 +48,62 @@ bt5_base_path = os.environ.get('erp5_tests_bt5_path', ...@@ -48,64 +48,62 @@ bt5_base_path = os.environ.get('erp5_tests_bt5_path',
os.path.join(INSTANCE_HOME, 'bt5')) os.path.join(INSTANCE_HOME, 'bt5'))
bootstrap_base_path = os.path.join(INSTANCE_HOME, 'Products', 'ERP5', 'bootstrap') bootstrap_base_path = os.path.join(INSTANCE_HOME, 'Products', 'ERP5', 'bootstrap')
# dependency order
target_business_templates = (
'erp5_base',
'erp5_trade',
'erp5_pdf_editor', class TestXHTML(ERP5TypeTestCase):
'erp5_pdf_style',
'erp5_pdm',
'erp5_accounting',
'erp5_invoicing',
'erp5_apparel',
## 'erp5_banking_core', run_all_test = 1
## 'erp5_banking_cash',
## 'erp5_banking_check',
## 'erp5_banking_inventory',
'erp5_budget', def getTitle(self):
'erp5_public_accounting_budget', return "XHTML Test"
'erp5_commerce', @staticmethod
def getBusinessTemplateList():
""" """
return ( # dependency order
'erp5_base',
'erp5_trade',
'erp5_consulting', 'erp5_pdf_editor',
'erp5_pdf_style',
'erp5_pdm',
'erp5_accounting',
'erp5_invoicing',
'erp5_ingestion', 'erp5_apparel',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_crm',
'erp5_web', ## 'erp5_banking_core',
'erp5_dms', ## 'erp5_banking_cash',
## 'erp5_banking_check',
## 'erp5_banking_inventory',
'erp5_forge', 'erp5_budget',
'erp5_public_accounting_budget',
'erp5_immobilisation', 'erp5_commerce',
'erp5_item', 'erp5_consulting',
'erp5_mrp', 'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_crm',
'erp5_payroll', 'erp5_web',
'erp5_dms',
'erp5_project', 'erp5_forge',
'erp5_calendar', 'erp5_immobilisation',
)
'erp5_item',
class TestXHTML(ERP5TypeTestCase): 'erp5_mrp',
run_all_test = 1 'erp5_payroll',
def getTitle(self): 'erp5_project',
return "XHTML Test"
def getBusinessTemplateList(self): 'erp5_calendar',
""" """ )
return target_business_templates
def afterSetUp(self): def afterSetUp(self):
self.portal = self.getPortal() self.portal = self.getPortal()
...@@ -396,14 +394,12 @@ def testPortalTypeViewRecursivly(validator, module_id, business_template_info, ...@@ -396,14 +394,12 @@ def testPortalTypeViewRecursivly(validator, module_id, business_template_info,
tested_portal_type_list=tested_portal_type_list) tested_portal_type_list=tested_portal_type_list)
def addTestMethodDynamically(validator): def addTestMethodDynamically(validator, target_business_templates):
from Products.ERP5.tests.utils import BusinessTemplateInfoTar from Products.ERP5.tests.utils import BusinessTemplateInfoTar
from Products.ERP5.tests.utils import BusinessTemplateInfoDir from Products.ERP5.tests.utils import BusinessTemplateInfoDir
business_template_info_list = [] business_template_info_list = []
# add erp5_core to the list here but not in the target_business_templates for i in target_business_templates:
# list to not return it on getBusinessTemplateList call
for i in ('erp5_core',) + target_business_templates:
business_template = os.path.join(bt5_base_path, i) business_template = os.path.join(bt5_base_path, i)
# Look for business templates, they can be: # Look for business templates, they can be:
...@@ -472,11 +468,13 @@ elif validator_to_use == 'tidy': ...@@ -472,11 +468,13 @@ elif validator_to_use == 'tidy':
else: else:
validator = TidyValidator(validator_path, show_warnings) validator = TidyValidator(validator_path, show_warnings)
# add the tests
if validator is not None:
addTestMethodDynamically(validator)
def test_suite(): def test_suite():
# add the tests
if validator is not None:
# add erp5_core to the list here to not return it
# on getBusinessTemplateList call
addTestMethodDynamically(validator,
('erp5_core',) + TestXHTML.getBusinessTemplateList())
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestXHTML)) suite.addTest(unittest.makeSuite(TestXHTML))
return suite return suite
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