[Zope-Checkins] CVS: Products/Transience/tests -
testTransactionHelper.py:1.1.2.1
testTransientObjectContainer.py:1.14.2.3.2.1
Chris McDonough
chrism at plope.com
Sat Sep 11 20:59:33 EDT 2004
Update of /cvs-repository/Products/Transience/tests
In directory cvs.zope.org:/tmp/cvs-serv28212/tests
Modified Files:
Tag: chrism-pre273-branch
testTransientObjectContainer.py
Added Files:
Tag: chrism-pre273-branch
testTransactionHelper.py
Log Message:
Add pre-2.7.3 changes on branch for review.
=== Added File Products/Transience/tests/testTransactionHelper.py ===
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
import sys, os, time, random, unittest
if __name__ == "__main__":
sys.path.insert(0, '../../..')
import ZODB
from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
from Products.Transience.TransactionHelper import PreventTransactionCommit, \
makeTransactionUncommittable
class TestTransactionHelper(TestCase):
def setUp(self):
self.t = get_transaction()
def tearDown(self):
self.t = None
def testUncommittable(self):
makeTransactionUncommittable(self.t, "test")
self.assertRaises(PreventTransactionCommit, get_transaction().commit)
def test_suite():
suite = makeSuite(TestTransactionHelper, 'test')
return suite
if __name__ == '__main__':
runner = TextTestRunner(verbosity=9)
runner.run(test_suite())
=== Products/Transience/tests/testTransientObjectContainer.py 1.14.2.3 => 1.14.2.3.2.1 ===
--- Products/Transience/tests/testTransientObjectContainer.py:1.14.2.3 Sun May 30 03:56:35 2004
+++ Products/Transience/tests/testTransientObjectContainer.py Sat Sep 11 20:59:32 2004
@@ -17,7 +17,7 @@
import ZODB
from Products.Transience.Transience import TransientObjectContainer,\
- MaxTransientObjectsExceeded
+ MaxTransientObjectsExceeded, SPARE_BUCKETS, getCurrentTimeslice
from Products.Transience.TransientObject import TransientObject
import Products.Transience.Transience
import Products.Transience.TransientObject
@@ -379,6 +379,13 @@
self.t[x] = x
fauxtime.sleep(180)
self.assertEqual(len(self.t.keys()), 100)
+
+ def testGarbageCollectionGetsInvoked(self):
+ for x in range(0, 100):
+ self.t[x] = x
+ fauxtime.sleep(self.period * (SPARE_BUCKETS + 2))
+ self.t.nudge()
+ self.assertEqual(list(self.t._data.keys()), [])
def _maxOut(self):
for x in range(11):
More information about the Zope-Checkins
mailing list