From 52de627af1a38e1c8e5067b2db8279f33bc42172 Mon Sep 17 00:00:00 2001 From: medmunds Date: Mon, 11 May 2015 18:09:56 -0700 Subject: [PATCH] Clean up test warnings for Django 1.8 * Django 1.8 requires TEMPLATES setting (for admin tests) * Ignore cycle tag deprecation warnings One remaining PendingDeprecationWarning: "the imp module is deprecated in favour of importlib" is coming from six, and has a fix waiting to land: https://bitbucket.org/gutworth/six/issue/112 --- djrill/tests/test_admin.py | 6 ++++++ runtests.py | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/djrill/tests/test_admin.py b/djrill/tests/test_admin.py index e1ce40a..bab34cd 100644 --- a/djrill/tests/test_admin.py +++ b/djrill/tests/test_admin.py @@ -1,4 +1,5 @@ import sys +import warnings from django.test import TestCase from django.contrib.auth.models import User @@ -9,6 +10,11 @@ from djrill.tests.mock_backend import DjrillBackendMockAPITestCase from .utils import override_settings +# We don't care that the `cycle` template tag will be removed in Django 2.0, +# because we're planning to drop the Djrill admin templates before then. +warnings.filterwarnings('ignore', category=PendingDeprecationWarning, + message="Loading the `cycle` tag from the `future` library") + def reset_admin_site(): """Return the Django admin globals to their original state""" diff --git a/runtests.py b/runtests.py index 15c8e6b..9482530 100644 --- a/runtests.py +++ b/runtests.py @@ -31,7 +31,29 @@ settings.configure( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - ) + ), + TEMPLATES=[ + # Django 1.8 starter-project template settings + # (needed for test_admin) + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ + # insert your TEMPLATE_DIRS here + ], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, + ], ) try: