mock 'time()' in cache tests
instead of calling 'sleep()' to let time advance. This shortens the time needed to run those tests, and ensures consistent results. (Tests would randomly fail when using 'sleep()')
This commit is contained in:
@@ -57,7 +57,7 @@ class MemoryCacheDecorator(CacheDecorator):
|
||||
value, expires = self.cache[key]
|
||||
except KeyError:
|
||||
expires = 0
|
||||
if expires < timestamp:
|
||||
if expires <= timestamp:
|
||||
value = self.func(*args, **kwargs)
|
||||
expires = timestamp + self.maxage
|
||||
self.cache[key] = value, expires
|
||||
|
||||
Reference in New Issue
Block a user