use cProfile instead of hotshot

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44576 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 481e1c66
...@@ -36,7 +36,8 @@ from DateTime import DateTime ...@@ -36,7 +36,8 @@ from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.tests.utils import LogInterceptor
import os, hotshot from cProfile import Profile
import os
# Define variable to chek if performance are good or not # Define variable to chek if performance are good or not
# XXX These variable are specific to the testing environment # XXX These variable are specific to the testing environment
...@@ -107,7 +108,7 @@ LISTBOX_COEF=0.00173 # 0.02472 ...@@ -107,7 +108,7 @@ LISTBOX_COEF=0.00173 # 0.02472
# LISTBOX_COEF : 0.02472 -> 0.001725 # LISTBOX_COEF : 0.02472 -> 0.001725
DO_TEST = 1 DO_TEST = 1
# set 1 to get hotshot profiler's result (unit_test/tests/<func_name>) # set 1 to get profiler's result (unit_test/tests/<func_name>)
PROFILE=0 PROFILE=0
class TestPerformance(ERP5TypeTestCase, LogInterceptor): class TestPerformance(ERP5TypeTestCase, LogInterceptor):
...@@ -207,9 +208,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -207,9 +208,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
os.unlink(prof_file) os.unlink(prof_file)
except OSError: except OSError:
pass pass
prof = hotshot.Profile(prof_file) prof = Profile()
prof.runcall(func) prof.runcall(func)
prof.close() prof.dump_stats(prof_file)
def test_00_viewBarObject(self, quiet=quiet, run=run_all_test, def test_00_viewBarObject(self, quiet=quiet, run=run_all_test,
min=None, max=None): min=None, max=None):
......
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