summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 890f8b6a9e..9dd7fa78e0 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -10,7 +10,6 @@ import tempfile
import threading
import time
import unittest
-import warnings
from unittest import mock
from django.conf import settings
@@ -632,12 +631,8 @@ class BaseCacheTests:
cache.key_func = func
try:
- with warnings.catch_warnings(record=True) as w:
- warnings.simplefilter("always")
+ with self.assertWarnsMessage(CacheKeyWarning, expected_warning):
cache.set(key, 'value')
- self.assertEqual(len(w), 1)
- self.assertIsInstance(w[0].message, CacheKeyWarning)
- self.assertEqual(str(w[0].message.args[0]), expected_warning)
finally:
cache.key_func = old_func