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): ...@@ -251,15 +251,16 @@ def runUnitTestList(test_list):
suite = ERP5TypeTestLoader(save=save).loadTestsFromNames(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') run_only = os.environ.get('run_only')
if run_only: if run_only:
test_method_list = run_only.split(',') test_method_list = run_only.split(',')
run_orig = unittest.TestCase.run from Testing.ZopeTestCase import profiler
def run(self, **kw): run_orig = profiler.Profiled.__call__
if id(self).rsplit('.', 1)[-1] in test_method_list: def run(self, *args, **kw):
return run_orig(self, **kw) if self.id().rsplit('.', 1)[-1] in test_method_list:
unittest.TestCase.run = run return run_orig(self, *args, **kw)
profiler.Profiled.__call__ = run
# change current directory to the test home, to create zLOG.log in this dir. # change current directory to the test home, to create zLOG.log in this dir.
os.chdir(tests_home) os.chdir(tests_home)
...@@ -331,7 +332,7 @@ def main(): ...@@ -331,7 +332,7 @@ def main():
os.environ["erp5_load_data_fs"] = "1" os.environ["erp5_load_data_fs"] = "1"
elif opt == "--erp5_catalog_storage": elif opt == "--erp5_catalog_storage":
os.environ["erp5_catalog_storage"] = arg os.environ["erp5_catalog_storage"] = arg
elif opt == "--run-only": elif opt == "--run_only":
os.environ["run_only"] = arg os.environ["run_only"] = arg
test_list = args 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