Commit 9c637fe6 authored by Alexandre Boeglin's avatar Alexandre Boeglin

It is now possible to run Unit Tests of our Products from this script.

the Class is now the only thing required in the Unit Test file.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2285 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c8bce6f9
......@@ -30,10 +30,18 @@ def runUnitTestList(test_list) :
os.chdir(tests_home)
# allow unit tests of our Products to be reached.
products_home = os.path.join(instance_home, 'Products')
from glob import glob
product_test_list = glob(products_home + os.sep + '*' + os.sep + 'tests')
sys.path += product_test_list
for test in test_list:
m = __import__(test)
if hasattr(m, 'test_suite'):
suite.addTest(m.test_suite())
for attr_name in dir(m) :
attr = getattr(m, attr_name)
if (type(attr) == type(type)) and (hasattr(attr, '__module__')) and (attr.__module__ == test) :
suite.addTest(unittest.makeSuite(attr))
TestRunner().run(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