Commit c11958f3 authored by Jérome Perrin's avatar Jérome Perrin

tests: adjust skips for PY3

parent 227fc082
...@@ -7,6 +7,7 @@ import sys ...@@ -7,6 +7,7 @@ import sys
from itertools import chain from itertools import chain
HERE = os.path.dirname(__file__) HERE = os.path.dirname(__file__)
PY3 = sys.version_info[0] > 2
class _ERP5(ERP5TypeTestSuite): class _ERP5(ERP5TypeTestSuite):
realtime_output = False realtime_output = False
...@@ -46,11 +47,12 @@ class _ERP5(ERP5TypeTestSuite): ...@@ -46,11 +47,12 @@ class _ERP5(ERP5TypeTestSuite):
component_re_match.group(2)) component_re_match.group(2))
else: else:
test_case = test_path.split(os.sep)[-1][:-3] # remove .py test_case = test_path.split(os.sep)[-1][:-3] # remove .py
if sys.version_info[0] > 2: if PY3:
# disable tests that are not compatible with Python 3. # disable tests that are not compatible with Python 3.
if test_case in ( if test_case in (
'erp5_workflow_test:testWorkflowAndDCWorkflow', # using legacy workflow # using legacy workflow
'testUpgradeInstanceWithOldDataFs', # using legacy workflow 'erp5_workflow_test:testWorkflowAndDCWorkflow',
'testUpgradeInstanceWithOldDataFsLegacyWorkflow'
): ):
continue continue
product = test_path.split(os.sep)[-3] product = test_path.split(os.sep)[-3]
...@@ -238,15 +240,24 @@ class ERP5BusinessTemplateCodingStyleTestSuite(_ERP5): ...@@ -238,15 +240,24 @@ class ERP5BusinessTemplateCodingStyleTestSuite(_ERP5):
"""Run coding style test on all business templates. """Run coding style test on all business templates.
""" """
def getTestList(self): def getTestList(self):
def skip_business_template(path):
# we skip coding style check for business templates having this marker
# property. Since the property is not exported (on purpose), modified business templates
# will be candidate for coding style test again.
if os.path.exists(path + '/bt/skip_coding_style_test'):
return True
if PY3 and os.path.basename(path) in (
'erp5_workflow_test', # uses legacy DCWorkflow
):
return True
return False
test_list = [ test_list = [
os.path.basename(path) os.path.basename(path)
for path in chain( for path in chain(
glob(HERE + '/../bt5/*'), glob(HERE + '/../bt5/*'),
glob(HERE + '/../product/ERP5/bootstrap/*')) glob(HERE + '/../product/ERP5/bootstrap/*'))
# we skip coding style check for business templates having this marker if os.path.isdir(path) and not skip_business_template(path)
# property. Since the property is not exported (on purpose), modified business templates
# will be candidate for coding style test again.
if not os.path.exists(path + '/bt/skip_coding_style_test') and os.path.isdir(path)
] ]
for path in chain(glob(HERE + '/../product/*'), for path in chain(glob(HERE + '/../product/*'),
glob(HERE + '/../bt5')): glob(HERE + '/../bt5')):
......
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