[Zodb-checkins] CVS: ZODB4/src/zodb/storage/tests - test_autopack.py:1.7

Barry Warsaw barry@wooz.org
Mon, 27 Jan 2003 11:59:15 -0500


Update of /cvs-repository/ZODB4/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv28813

Modified Files:
	test_autopack.py 
Log Message:
Shorten the time.sleeps to speed up the autopack tests.


=== ZODB4/src/zodb/storage/tests/test_autopack.py 1.6 => 1.7 ===
--- ZODB4/src/zodb/storage/tests/test_autopack.py:1.6	Mon Jan 27 11:23:48 2003
+++ ZODB4/src/zodb/storage/tests/test_autopack.py	Mon Jan 27 11:59:11 2003
@@ -45,9 +45,9 @@
 class TestAutopackBase(BerkeleyTestBase):
     def _config(self):
         config = BerkeleyConfig()
-        # Autopack every 3 seconds, 6 seconds into the past, no classic packs
-        config.frequency = 3
-        config.packtime = 6
+        # Autopack every 1 second, 2 seconds into the past, no classic packs
+        config.frequency = 1
+        config.packtime = 2
         config.classicpack = 0
         return config
 
@@ -56,7 +56,7 @@
         # BAW: this uses a non-public interface
         packtime = storage._autopacker._nextcheck
         while packtime == storage._autopacker._nextcheck:
-            time.sleep(1)
+            time.sleep(0.1)
 
 
 
@@ -82,8 +82,8 @@
         unless(storage.loadSerial(oid, revid1))
         unless(storage.loadSerial(oid, revid2))
         unless(storage.loadSerial(oid, revid3))
-        # Should be enough time for the revisions to get packed away
-        time.sleep(10)
+        # Two more autopacks ought to be enough to pack away old revisions
+        self._wait_for_next_autopack()
         self._wait_for_next_autopack()
         # The first two revisions should now be gone, but the third should
         # still exist because it's the current revision, and we haven't done a
@@ -99,9 +99,10 @@
 
     def _config(self):
         config = BerkeleyConfig()
-        # Autopack every 3 seconds, 6 seconds into the past, no classic packs
-        config.frequency = 3
-        config.packtime = 6
+        # Autopack every 1 second, 2 seconds into the past, classic packing
+        # every time.
+        config.frequency = 1
+        config.packtime = 2
         config.classicpack = 1
         return config
 
@@ -123,8 +124,8 @@
         unless(storage.loadSerial(oid, revid1))
         unless(storage.loadSerial(oid, revid2))
         unless(storage.loadSerial(oid, revid3))
-        # Should be enough time for the revisions to get packed away
-        time.sleep(10)
+        # Two more autopacks ought to be enough to pack away old revisions
+        self._wait_for_next_autopack()
         self._wait_for_next_autopack()
         # The first two revisions should now be gone, but the third should
         # still exist because it's the current revision, and we haven't done a
@@ -292,7 +293,7 @@
         # complete.
         now = time.time()
         while now == time.time():
-            time.sleep(0.5)
+            time.sleep(0.1)
         self._cv.acquire()
         packthread = self._getPackThread(storage)
         packthread.start()
@@ -343,7 +344,7 @@
         # complete.
         now = time.time()
         while now == time.time():
-            time.sleep(0.5)
+            time.sleep(0.1)
         self._cv.acquire()
         packthread = self._getPackThread(storage)
         packthread.start()