Skip to content

Commit

Permalink
Solve intermittent error during testing of CleanupDict class, as a
Browse files Browse the repository at this point in the history
cleanup period of zero seconds would not always result in a cleanup,
if the tests were run fast.

svn path=/plone.memoize/trunk/; revision=36797
  • Loading branch information
mauritsvanrees committed May 28, 2010
1 parent c893b7c commit 14740d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,11 @@ Changelog
1.1b2 - Unreleased
------------------

- Solve intermittent error during testing of CleanupDict class, as a
cleanup period of zero seconds would not always result in a cleanup,
if the tests were run fast.
[maurits]


1.1b1 - 2009-11-13
------------------
Expand Down
8 changes: 6 additions & 2 deletions plone/memoize/volatile.py
Expand Up @@ -212,7 +212,11 @@ class CleanupDict(dict):
>>> d['spam']
'bar'
>>> d = CleanupDict(0)
Setting the cleanup period to 0 (or a negative number) means the
values are thrown away immediately. (Note that we do not test with
exactly zero, as running the tests can go too fast.)
>>> d = CleanupDict(-0.00001)
>>> d['spam'] = 'bar'
>>> d['spam'] # doctest: +ELLIPSIS
Traceback (most recent call last):
Expand Down Expand Up @@ -244,7 +248,7 @@ def _cleanup(self):
if timestamp < okay:
del self._last_access[key]
super(CleanupDict, self).__delitem__(key)

ATTR = '_v_memoize_cache'
CONTAINER_FACTORY = CleanupDict
_marker = object()
Expand Down

0 comments on commit 14740d9

Please sign in to comment.