Opened 3 years ago

Closed 3 years ago

Last modified 23 months ago

#21147 closed Bug (fixed)

cache.tests.FileBasedCacheTests.test_zero_timeout fails with sqlite on windows

Reported by: Michael Manfre Owned by: nobody
Component: Core (Cache system) Version: 1.6-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

cache.tests.FileBasedCacheTests.test_zero_timeout fails with sqlite on windows.

======================================================================
FAIL: test_zero_timeout (cache.tests.FileBasedCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\django\django\tests\cache\tests.py", line 466, in test_zero_timeout
    self.assertEqual(self.cache.get('key1'), None)
AssertionError: u'eggs' != None

Change History (8)

comment:1 Changed 3 years ago by Michael Manfre

Severity: NormalRelease blocker
Version: master1.6-beta-1

Worked with Django 1.5. This is a regression.

comment:2 Changed 3 years ago by Michael Manfre

Triage Stage: UnreviewedAccepted

Regression introduced with changeset 89955cc35f3636684ea6f2a6c9504b35a3050f0f #9595

comment:3 Changed 3 years ago by Michael Manfre

Severity: Release blockerNormal
Type: UncategorizedBug

Not a regression. After manually adding the failing test to 1.5.4, it still fails. Issue is due to precision of time.time() and the speed of the system running the tests. On Windows, the precision is ~15 ms.

Last edited 3 years ago by Michael Manfre (previous) (diff)

comment:4 Changed 3 years ago by Michael Manfre

https://github.com/django/django/pull/1668

The newly added get_backend_timeout is intentionally not documented to avoid it becoming an officially supported part of the API.

comment:5 Changed 3 years ago by Michael Manfre

Has patch: set

comment:6 Changed 3 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin

comment:7 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In bf757a2f4dad519fac1b4a458376de3a040f5ca8:

Fixed #21147 -- Avoided time.time precision issue with cache backends.

The precision of time.time() is OS specific and it is possible for the
resolution to be low enough to allow reading a cache key previously set
with a timeout of 0.

comment:8 Changed 23 months ago by Tim Graham <timograham@…>

In 40d6b376d4ac29c1f271bb827cd9ca24860ce4b5:

Removed BaseMemcachedCacheMethods._get_memcache_timeout backwards compatibility shim.

Per deprecation timeline; refs #21147.

Note: See TracTickets for help on using tickets.
Back to Top