aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/tests
diff options
context:
space:
mode:
authorTim Bell <tim@oodar.com.au>2015-10-21 09:35:36 +1100
committerTim Bell <tim@oodar.com.au>2015-10-21 09:35:36 +1100
commit8224c46c84bc0d25c36d49d13610e8c4d02e2c5c (patch)
treee26c36eceb1c55019feb99f8f215733cc531f7f3 /wkhtmltopdf/tests
parent2e8ea75aa5b69351b79c5fc7bf0a61fe95749cb7 (diff)
downloaddjango-wkhtmltopdf-8224c46c84bc0d25c36d49d13610e8c4d02e2c5c.tar.gz
django-wkhtmltopdf-8224c46c84bc0d25c36d49d13610e8c4d02e2c5c.tar.bz2
django-wkhtmltopdf-8224c46c84bc0d25c36d49d13610e8c4d02e2c5c.zip
Enable tests to run with Django >= 1.7 and silence warnings
Diffstat (limited to 'wkhtmltopdf/tests')
-rw-r--r--wkhtmltopdf/tests/run.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/wkhtmltopdf/tests/run.py b/wkhtmltopdf/tests/run.py
index a840e68..5004ee1 100644
--- a/wkhtmltopdf/tests/run.py
+++ b/wkhtmltopdf/tests/run.py
@@ -2,10 +2,12 @@
import os
import sys
+import django
from django.conf import settings
DIRNAME = os.path.abspath(os.path.dirname(__file__))
+sys.path.insert(0, os.getcwd())
settings.configure(
DEBUG=True,
@@ -19,6 +21,10 @@ settings.configure(
'wkhtmltopdf.tests',
'wkhtmltopdf',
),
+ MIDDLEWARE_CLASSES=(
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ ),
MEDIA_ROOT=os.path.join(DIRNAME, 'media'),
MEDIA_URL='/media/',
STATIC_ROOT=os.path.join(DIRNAME, 'static'),
@@ -27,6 +33,12 @@ settings.configure(
)
try:
+ django.setup()
+except AttributeError:
+ pass # Django < 1.7; okay to ignore
+
+
+try:
from django.test.runner import DiscoverRunner
except ImportError:
from discover_runner.runner import DiscoverRunner