diff options
| author | Morgan Aubert <morgan.aubert@impakfinance.com> | 2018-04-27 17:18:15 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-05-09 11:40:28 -0400 |
| commit | 704443acacf0dfbcb1c52df4b260585055754ce7 (patch) | |
| tree | 600147bf6114d7b490fcd253ff9797b7e7531c09 /tests/cache | |
| parent | 7ba040de7703fd06b9b35ddd31da40103d911c30 (diff) | |
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
Diffstat (limited to 'tests/cache')
| -rw-r--r-- | tests/cache/tests.py | 7 |
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 |
