* `cache.tests.PyLibMCCacheTests.test_touch`
* `cache.tests.PyMemcacheCacheTests.test_touch`
{{{
Traceback (most recent call last):
File "/home/jenkins/workspace/pull-requests-
bionic/database/sqlite3/label/bionic-
pr/python/python3.8/tests/cache/tests.py", line 481, in test_touch
self.assertIs(cache.touch('expire1'), True)
AssertionError: False is not True
}}}
Both test classes inherit from `BaseCacheTests`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32831>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> The following tests occasionally fail in CI:
>
> * `cache.tests.PyLibMCCacheTests.test_touch`
> * `cache.tests.PyMemcacheCacheTests.test_touch`
>
> {{{
> Traceback (most recent call last):
> File "/home/jenkins/workspace/pull-requests-
> bionic/database/sqlite3/label/bionic-
> pr/python/python3.8/tests/cache/tests.py", line 481, in test_touch
> self.assertIs(cache.touch('expire1'), True)
> AssertionError: False is not True
> }}}
>
> Both test classes inherit from `BaseCacheTests`.
New description:
The following tests occasionally fail in CI:
* `cache.tests.PyLibMCCacheTests.test_touch`
* `cache.tests.PyMemcacheCacheTests.test_touch`
{{{
Traceback (most recent call last):
File "/home/jenkins/workspace/pull-requests-
bionic/database/sqlite3/label/bionic-
pr/python/python3.8/tests/cache/tests.py", line 481, in test_touch
self.assertIs(cache.touch('expire1'), True)
AssertionError: False is not True
}}}
The line that fails is here:
https://github.com/django/django/blob/ed3af3ff4b3cfb72de598f1b39a1028ba3826efb/tests/cache/tests.py#L481
Both test classes inherit from `BaseCacheTests`.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:1>
* stage: Unreviewed => Accepted
Comment:
Yes these tests are flaky (and probably 2-3 more cache tests). We tried to
fix them in the past but with no success (see
[https://github.com/django/django/pull/13496 PR]).
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:2>
Old description:
> The following tests occasionally fail in CI:
>
> * `cache.tests.PyLibMCCacheTests.test_touch`
> * `cache.tests.PyMemcacheCacheTests.test_touch`
>
> {{{
> Traceback (most recent call last):
> File "/home/jenkins/workspace/pull-requests-
> bionic/database/sqlite3/label/bionic-
> pr/python/python3.8/tests/cache/tests.py", line 481, in test_touch
> self.assertIs(cache.touch('expire1'), True)
> AssertionError: False is not True
> }}}
>
> The line that fails is here:
> https://github.com/django/django/blob/ed3af3ff4b3cfb72de598f1b39a1028ba3826efb/tests/cache/tests.py#L481
>
> Both test classes inherit from `BaseCacheTests`.
New description:
The following tests occasionally fail in CI:
* `cache.tests.PyLibMCCacheTests.test_touch`
* `cache.tests.PyMemcacheCacheTests.test_touch`
{{{
Traceback (most recent call last):
File "/home/jenkins/workspace/pull-requests-
bionic/database/sqlite3/label/bionic-
pr/python/python3.8/tests/cache/tests.py", line 481, in test_touch
self.assertIs(cache.touch('expire1'), True)
AssertionError: False is not True
}}}
The line that fails is here:
https://github.com/django/django/blob/ed3af3ff4b3cfb72de598f1b39a1028ba3826efb/tests/cache/tests.py#L481
Both test classes inherit from `BaseMemcachedTests`, which inherits from
`BaseCacheTests`.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:3>
Comment (by Chris Jerdonek):
Could this be due to different concrete subclasses of `BaseMemcachedTests`
stepping on each other during a parallel run?
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:4>
Comment (by Chris Jerdonek):
Another cache-related flaky test is:
`cache.tests.CacheMiddlewareTest.test_cache_page_timeout`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:5>
Comment (by Chris Jerdonek):
A possible pattern for fixing issues like this would be to keep retrying
the assertion in a `while` loop, with a small sleep in between each
attempt, and a relatively large cumulative amount of time before giving
up. That would make it as pass as quickly as possible, without waiting
longer than necessary.
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:6>
Comment (by Chris Jerdonek):
Something else that occurred to me is that it could only help to start
each test by asserting that each key being used isn't set, and to end each
test by clearing the key in a finally block. The former would help to show
if a test isolation issue is at fault.
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:7>
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:8>
* owner: nobody => Chris Jerdonek
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:9>
Comment (by Chris Jerdonek):
Another flaky test failure: `test_forever_timeout()` at this line--
https://github.com/django/django/blob/1697098795707bd39501d9ceddd3d9be93f8d549/tests/cache/tests.py#L606
(again with `pull-requests-bionic/database=spatialite,label=bionic-
pr,python=python3.8`).
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:10>
* owner: Chris Jerdonek => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:11>
Comment (by Natalia Bidart):
I started some debugging efforts [https://forum.djangoproject.com/t/flaky-
cache-tests/26990/4 in this forum post] and landed a fix for `test_touch`
when using [https://github.com/django/django/pull/17614 the filebased
cache backend].
--
Ticket URL: <https://code.djangoproject.com/ticket/32831#comment:12>