Commit 0fdf670a authored by Yoshinori Okuji's avatar Yoshinori Okuji

Patch profiler instead of unittest, because we use the profiler.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16640 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 89e8ea1b
......@@ -251,15 +251,16 @@ def runUnitTestList(test_list):
suite = ERP5TypeTestLoader(save=save).loadTestsFromNames(test_list)
# Hack the TestCase to run only specified test methods.
# Hack the profiler to run only specified test methods.
run_only = os.environ.get('run_only')
if run_only:
test_method_list = run_only.split(',')
run_orig = unittest.TestCase.run
def run(self, **kw):
if id(self).rsplit('.', 1)[-1] in test_method_list:
return run_orig(self, **kw)
unittest.TestCase.run = run
from Testing.ZopeTestCase import profiler
run_orig = profiler.Profiled.__call__
def run(self, *args, **kw):
if self.id().rsplit('.', 1)[-1] in test_method_list:
return run_orig(self, *args, **kw)
profiler.Profiled.__call__ = run
# change current directory to the test home, to create zLOG.log in this dir.
os.chdir(tests_home)
......@@ -331,7 +332,7 @@ def main():
os.environ["erp5_load_data_fs"] = "1"
elif opt == "--erp5_catalog_storage":
os.environ["erp5_catalog_storage"] = arg
elif opt == "--run-only":
elif opt == "--run_only":
os.environ["run_only"] = arg
test_list = args
......
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