Commit 8a402790 authored by Nicolas Delaby's avatar Nicolas Delaby

tests is a plural form and it is deprecated.

add backward compatibility support
parent 1291b287
...@@ -5,17 +5,23 @@ from ERP5TypeTestSuite import ERP5TypeTestSuite ...@@ -5,17 +5,23 @@ from ERP5TypeTestSuite import ERP5TypeTestSuite
def makeSuite(node_quantity=None, test_suite=None, revision=None, def makeSuite(node_quantity=None, test_suite=None, revision=None,
db_list=None): db_list=None):
# BBB tests (plural form) is only checked for backward compatibility
for k in sys.modules.keys(): for k in sys.modules.keys():
if k == 'tests' or k.startswith('tests.'): if k in ('tests', 'test',) or k.startswith('tests.') or k.startswith('test.'):
del sys.modules[k] del sys.modules[k]
module_name, class_name = ('tests.' + \ singular_succeed = True
test_suite).rsplit('.', 1) while True:
module_name, class_name = ('%s.%s' % (singular_succeed and 'test' or 'tests',
try: test_suite)).rsplit('.', 1)
suite_class = getattr(__import__(module_name, None, None, [class_name]), try:
class_name) suite_class = getattr(__import__(module_name, None, None, [class_name]),
except (AttributeError, ImportError): class_name)
raise except (AttributeError, ImportError):
if not singular_succeed:
raise
singular_succeed = False
else:
break
suite = suite_class(revision=revision, suite = suite_class(revision=revision,
max_instance_count=node_quantity, max_instance_count=node_quantity,
mysql_db_list=db_list.split(','), mysql_db_list=db_list.split(','),
......
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