Commit 44ee7ffd authored by Sebastien Robin's avatar Sebastien Robin

ask the garbage collector to collect instead of only setting a high treshold

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14901 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b8526985
...@@ -42,6 +42,7 @@ from Products.ERP5Type.ERP5Type import ERP5TypeInformation ...@@ -42,6 +42,7 @@ from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Cache import clearCache from Products.ERP5Type.Cache import clearCache
from DateTime import DateTime from DateTime import DateTime
from time import time from time import time
import gc
# 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
...@@ -84,12 +85,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -84,12 +85,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
""" """
self.login() self.login()
self.bar_module = self.getBarModule() self.bar_module = self.getBarModule()
# Make the collection frequency higher,
# because if it is waiting too much time, then the collection
# take too much time and the test fails
import gc
gc.set_threshold(5000, 10, 10)
def test_00_viewBarObject(self, quiet=quiet, run=run_all_test): def test_00_viewBarObject(self, quiet=quiet, run=run_all_test):
""" """
...@@ -137,6 +132,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -137,6 +132,7 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
view_result = {} view_result = {}
tic_result = {} tic_result = {}
add_result = {} add_result = {}
gc.collect()
# add object in bar module # add object in bar module
for i in xrange(10): for i in xrange(10):
before_add = time() before_add = time()
...@@ -149,6 +145,13 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -149,6 +145,13 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
before_tic = time() before_tic = time()
self.tic() self.tic()
after_tic = time() after_tic = time()
# Explicit collect of the garbage collector,
# So no garbage collection will happen while reindexing,
# like this we prevent random garbage collection wich
# was making the test failing randomly
gc.collect()
before_form = time() before_form = time()
for x in xrange(100): for x in xrange(100):
self.bar_module.BarModule_viewBarList() self.bar_module.BarModule_viewBarList()
......
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