Skip to content

Commit 198304a

Browse files
committed
Account for Django cache culling probability.
1 parent 8311545 commit 198304a

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

docs/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Pending
3131
needing to respect ``django.conf.settings.DEBUG`` to match
3232
``debug_toolbar_urls``.
3333
* Fixed cookie ``expires`` calculation in ``djdt.cookie.set``.
34+
* Account for the new ``CULL_PROBABILITY`` in Django 6.2 in tests.
3435

3536
6.3.0 (2026-04-01)
3637
------------------

tests/test_store.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ def test_cache_store_operations_not_tracked_by_cache_panel(self):
358358
"ddt_db_cache": {
359359
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
360360
"LOCATION": "test_cache_store_table",
361+
# Force the culling to occur on all writes in Django
362+
"OPTIONS": {"CULL_PROBABILITY": 1},
361363
}
362364
},
363365
)
@@ -483,12 +485,6 @@ def test_database_backend_can_be_tracked_by_sql_panel(self):
483485
for q in sql_panel._queries[initial_query_count:]
484486
if "test_cache_store_table" in q.get("sql", "").lower()
485487
]
486-
487-
self.assertEqual(
488-
len(cache_queries),
489-
4,
490-
f"CacheStore DatabaseCache operations be tracked by SQLPanel, "
491-
f"but found {len(cache_queries)} queries to 'test_cache_store_table' table",
492-
)
488+
self.assertEqual(len(cache_queries), 4)
493489
finally:
494490
sql_panel.disable_instrumentation()

0 commit comments

Comments
 (0)