[Zope-Checkins] CVS: Zope/lib/python/Products/Transience/tests - testTransientObjectContainer.py:1.14.2.2

Chris McDonough chrism at plope.com
Sat May 22 23:52:27 EDT 2004


Update of /cvs-repository/Zope/lib/python/Products/Transience/tests
In directory cvs.zope.org:/tmp/cvs-serv16636/lib/python/Products/Transience/tests

Modified Files:
      Tag: Zope-2_7-branch
	testTransientObjectContainer.py 
Log Message:
- Add "instance-local" "period" to TransientObjectContainer.  This allows
  users to dial a knob which may (or may not) reduce the number of conflicts
  that happen during heavy sessioning usage by reducing the frequency at
  which buckets potentially expire at the cost of expiration time
  accuracy.  Previously, this setting was hardcoded to 20 (seconds) at
  module scope.

- Add 'session-resolution-seconds' to zope.conf.in/zopeschema.xml to
  control instance-local period for /temp_folder/session_data.

- Update TOC UI, interface, and help files to deal with instance-local
  period.

- Update OFS/Application to deal with instance-local period for default
  /temp/session_data TOC.

- Use __setstate__ for TOC upgrade instead of a dedicated _upgrade method
  (it was too hard to figure out where to call _upgrade from and when to
  call it).

- Perform a few formatting changes that should make it easier to merge the 2.7
  branch with the HEAD going forward.  I beseech those who make formatting
  changes to a branch or the HEAD make them to the other at that time
  as well, especially with the SVN/CVS split it's very painful to do merging
  when there are non-substantive differences between HEAD/maint.  When I was
  a child, I never thought I would need to use the word "beseech", however, it
  has indeed happened.



=== Zope/lib/python/Products/Transience/tests/testTransientObjectContainer.py 1.14.2.1 => 1.14.2.2 ===
--- Zope/lib/python/Products/Transience/tests/testTransientObjectContainer.py:1.14.2.1	Fri May 14 18:52:13 2004
+++ Zope/lib/python/Products/Transience/tests/testTransientObjectContainer.py	Sat May 22 23:51:57 2004
@@ -34,7 +34,9 @@
                                           
         self.errmargin = .20
         self.timeout = 120
-        self.t = TransientObjectContainer('sdc', timeout_mins=self.timeout/60)
+        self.period = 20
+        self.t = TransientObjectContainer('sdc', timeout_mins=self.timeout/60,
+                                          period_secs=self.period)
 
     def tearDown(self):
         self.t = None
@@ -267,7 +269,7 @@
         self.assertEqual(len(self.t.keys()), 0)
 
         # 2 minutes
-        self.t._setTimeout(self.timeout/60*2)
+        self.t._setTimeout(self.timeout/60*2, self.period)
         self.t._reset()
         for x in range(10, 110):
             self.t[x] = x
@@ -279,7 +281,7 @@
         self.assertEqual(len(self.t.keys()), 0)
 
         # 3 minutes
-        self.t._setTimeout(self.timeout/60*3)
+        self.t._setTimeout(self.timeout/60*3, self.period)
         self.t._reset()
         for x in range(10, 110):
             self.t[x] = x
@@ -318,7 +320,8 @@
 
     def testLen(self):
         # This test must not time out else it will fail.
-        self.t._setTimeout(self.timeout)  # make timeout extremely unlikely
+        # make timeout extremely unlikely by setting it very high
+        self.t._setTimeout(self.timeout, self.period)
         added = {}
         r = range(10, 1010)
         for x in r:
@@ -340,8 +343,9 @@
 
     def testGetTimeoutMinutesWorks(self):
         self.assertEqual(self.t.getTimeoutMinutes(), self.timeout / 60)
-        self.t._setTimeout(10)
+        self.t._setTimeout(10, 30)
         self.assertEqual(self.t.getTimeoutMinutes(), 10)
+        self.assertEqual(self.t.getPeriodSeconds(), 30)
 
     def test_new(self):
         t = self.t.new('foobieblech')
@@ -369,7 +373,7 @@
         self.assertRaises(MaxTransientObjectsExceeded, self._maxOut)
 
     def testZeroTimeoutMeansPersistForever(self):
-        self.t._setTimeout(0)
+        self.t._setTimeout(0, self.period)
         self.t._reset()
         for x in range(10, 110):
             self.t[x] = x




More information about the Zope-Checkins mailing list