[Erp5-report] r20136 - /erp5/trunk/products/ERP5Type/tests/testPerformance.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Mar 26 10:06:29 CET 2008
Author: jerome
Date: Wed Mar 26 10:06:27 2008
New Revision: 20136
URL: http://svn.erp5.org?rev=20136&view=rev
Log:
tests the performance of a form with proxy fields
Modified:
erp5/trunk/products/ERP5Type/tests/testPerformance.py
Modified: erp5/trunk/products/ERP5Type/tests/testPerformance.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testPerformance.py?rev=20136&r1=20135&r2=20136&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testPerformance.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testPerformance.py Wed Mar 26 10:06:27 2008
@@ -30,6 +30,7 @@
from time import time
import gc
+from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
from Products.CMFCore.tests.base.testcase import LogInterceptor
@@ -39,6 +40,8 @@
# (which has 31645.6 pystones/second)
MIN_OBJECT_VIEW=0.112
MAX_OBJECT_VIEW=0.122
+MIN_OBJECT_PROXYFIELD_VIEW=0.112
+MAX_OBJECT_PROXYFIELD_VIEW=0.122
CURRENT_MIN_OBJECT_VIEW=0.1220
CURRENT_MAX_OBJECT_VIEW=0.1280
MIN_MODULE_VIEW=0.125
@@ -210,6 +213,41 @@
MIN_TIC, tic_value, MAX_TIC))
i += 1
+
+ def test_viewProxyField(self, quiet=quiet):
+ # render a form with proxy fields: Foo_viewProxyField
+ foo = self.portal.foo_module.newContent(
+ portal_type='Foo',
+ title='Bar Test',
+ quantity=10000,
+ price=32,
+ start_date=DateTime(2008,1,1))
+ foo.newContent(portal_type='Foo Line',
+ title='Line 1')
+ foo.newContent(portal_type='Foo Line',
+ title='Line 2')
+ get_transaction().commit()
+ self.tic()
+ # Check performance
+ before_view = time()
+ for x in xrange(100):
+ foo.Foo_viewProxyField()
+ after_view = time()
+ req_time = (after_view - before_view)/100.
+
+ if not quiet:
+ print "time to view proxyfield form %.4f < %.4f < %.4f\n" % \
+ ( MIN_OBJECT_PROXYFIELD_VIEW,
+ req_time,
+ MAX_OBJECT_PROXYFIELD_VIEW )
+ if DO_TEST:
+ self.failUnless( MIN_OBJECT_PROXYFIELD_VIEW < req_time
+ < MAX_OBJECT_PROXYFIELD_VIEW,
+ '%.4f < %.4f < %.4f' % (
+ MIN_OBJECT_PROXYFIELD_VIEW,
+ req_time,
+ MAX_OBJECT_PROXYFIELD_VIEW))
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerformance))
More information about the Erp5-report
mailing list