Commit 1bf425ca authored by Jérome Perrin's avatar Jérome Perrin

CodingStyleTest: run testXHTML for each business template

This will allow to find problems when only business templates and their
dependencies are installed. When we run testXHTML with all business
template installed we don't see problems that may happen only when some
business templates are not installed.
parent 9aa6b278
...@@ -31,9 +31,12 @@ import os ...@@ -31,9 +31,12 @@ import os
import unittest import unittest
from glob import glob from glob import glob
from Products.ERP5.tests import testXHTML
from Products.ERP5Type.tests.utils import addUserToDeveloperRole
from Products.ERP5Type.tests.CodingStyleTestCase import CodingStyleTestCase from Products.ERP5Type.tests.CodingStyleTestCase import CodingStyleTestCase
class CodingStyleTest(CodingStyleTestCase):
class CodingStyleTest(CodingStyleTestCase, testXHTML.TestXHTMLMixin):
"""Run a coding style test for business template defined by """Run a coding style test for business template defined by
TESTED_BUSINESS_TEMPLATE environment variable, that is set by TESTED_BUSINESS_TEMPLATE environment variable, that is set by
ERP5BusinessTemplateCodingStyleTestSuite in test/__init__.py ERP5BusinessTemplateCodingStyleTestSuite in test/__init__.py
...@@ -81,15 +84,29 @@ class CodingStyleTest(CodingStyleTestCase): ...@@ -81,15 +84,29 @@ class CodingStyleTest(CodingStyleTestCase):
self)._installBusinessTemplateList(url_bt_tuple_list, self)._installBusinessTemplateList(url_bt_tuple_list,
*args, **kwargs) *args, **kwargs)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
tested_business_template = os.environ['TESTED_BUSINESS_TEMPLATE'] tested_business_template = os.environ['TESTED_BUSINESS_TEMPLATE']
testclass = type( testclass = type(
'CodingStyleTest %s' % tested_business_template, 'CodingStyleTest %s' % tested_business_template,
(CodingStyleTest, ), (CodingStyleTest,),
{'tested_business_template': tested_business_template}) {
'tested_business_template': tested_business_template,
# currently, jsl based test_javascript_lint report too many false positives.
'test_javascript_lint': None,
},
)
testXHTML.addTestMethodDynamically(
testclass,
testXHTML.validator,
(tested_business_template,),
)
# required to create content in portal_components
addUserToDeveloperRole('ERP5TypeTestCase')
suite.addTest(unittest.makeSuite(testclass)) suite.addTest(unittest.makeSuite(testclass))
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