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/admin_views | |
| parent | 7ba040de7703fd06b9b35ddd31da40103d911c30 (diff) | |
Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage().
Diffstat (limited to 'tests/admin_views')
| -rw-r--r-- | tests/admin_views/test_static_deprecation.py | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/tests/admin_views/test_static_deprecation.py b/tests/admin_views/test_static_deprecation.py index fb64df6f5f..166e27ef37 100644 --- a/tests/admin_views/test_static_deprecation.py +++ b/tests/admin_views/test_static_deprecation.py @@ -1,5 +1,3 @@ -import warnings - from django.contrib.admin.templatetags.admin_static import static from django.contrib.staticfiles.storage import staticfiles_storage from django.test import SimpleTestCase @@ -19,12 +17,8 @@ class AdminStaticDeprecationTests(SimpleTestCase): old_url = staticfiles_storage.base_url staticfiles_storage.base_url = '/test/' try: - with warnings.catch_warnings(record=True) as recorded: - warnings.simplefilter('always') + with self.assertWarnsMessage(RemovedInDjango30Warning, msg): url = static('path') self.assertEqual(url, '/test/path') - self.assertEqual(len(recorded), 1) - self.assertIs(recorded[0].category, RemovedInDjango30Warning) - self.assertEqual(str(recorded[0].message), msg) finally: staticfiles_storage.base_url = old_url |
