[py-svn] r12214 - py/dist/py/misc/testing

hpk at codespeak.net hpk at codespeak.net
Thu May 12 13:51:58 CEST 2005


Author: hpk
Date: Thu May 12 13:51:57 2005
New Revision: 12214

Modified:
   py/dist/py/misc/testing/test_cache.py
Log:
sanitized cache evition test slightly 


Modified: py/dist/py/misc/testing/test_cache.py
==============================================================================
--- py/dist/py/misc/testing/test_cache.py	(original)
+++ py/dist/py/misc/testing/test_cache.py	Thu May 12 13:51:57 2005
@@ -51,8 +51,13 @@
 
     def test_cache_eviction(self):
         self.cache.getorbuild(17, lambda: 17)
-        py.std.time.sleep(self.maxsecs*1.3)
-        assert self.cache.getentry(17) is None
+        endtime = py.std.time.time() + self.maxsecs * 10 
+        while py.std.time.time() < endtime: 
+            if self.cache.getentry(17) is None: 
+                break 
+            py.std.time.sleep(self.maxsecs*0.3) 
+        else: 
+            py.test.fail("waiting for cache eviction failed") 
 
 def test_prune_lowestweight(): 
     maxsecs = 0.05 



More information about the pytest-commit mailing list