[py-dev] Intermittent errors on py/misc/testing/test_cache.py

holger krekel hpk at trillke.net
Thu May 12 13:54:50 CEST 2005


Hi Grig, 

On Tue, May 10, 2005 at 16:05 -0700, Grig Gheorghiu wrote:
> I sometimes get this error on a WinXP box:
> 
>     def test_cache_eviction(self):
>         self.cache.getorbuild(17, lambda: 17)
>         py.std.time.sleep(self.maxsecs*1.3)
> E       assert self.cache.getentry(17) is None
> >       AssertionError

side note: weren't there more details shown in the
next line? 

> [C:\py\py\misc\testing\test_cache.py:55]
> [modulepath: TestAging().test_cache_eviction]
> 
> It happens pretty consistently, but not all the time.
> I haven't seen it yet on Win2K Pro or Red Hat 9.

The test is badly written on my side. Waiting fixed amounts of
time is a bad idea and i am guessing that the time resolution
has interactions with platform details.  I have rewritten the
test to loop longer ... although i think the real solution
would be to set the time that the 'cache' perceives  manually
from the test and then check that the eviction logic does
its work.

cheers, 

    holger


More information about the py-dev mailing list