Changeset 1765 in products
- Timestamp:
- Feb 17, 2010 8:09:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.catalogupdater/trunk/quintagroup/catalogupdater/tests.py
r1758 r1765 1 1 import unittest 2 import transaction 2 3 3 4 from zope.interface import Interface … … 98 99 99 100 101 def testTransaction(self): 102 """ Test is commited subtransactions 103 """ 104 # savepoint patch 105 global sp_commits 106 sp_commits = 1 # Starts from 1 to count last commit 107 orig_trsp = transaction.savepoint 108 def dummy_savepoint(*args, **kwargs): 109 global sp_commits 110 sp_commits += 1 111 orig_trsp(*args, **kwargs) 112 transaction.savepoint = dummy_savepoint 113 114 # set threshold for catalog 115 num_recs = len(self.catalog.unrestrictedSearchResults(path='/')) 116 num_subcommits = 3 117 self.catalog.threshold = num_recs/num_subcommits 118 119 cu = queryUtility(ICatalogUpdater, name="catalog_updater") 120 cu.updateMetadata4All(self.catalog, 'test_column') 121 122 self.assertTrue(sp_commits == num_subcommits, 123 "Wrong number of transaction subcommits: actual:%d, must be: %d" % ( 124 sp_commits, num_subcommits)) 125 126 transaction.savepoint = orig_trsp 127 128 129 100 130 def test_suite(): 101 131 return unittest.TestSuite([
Note: See TracChangeset
for help on using the changeset viewer.