aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/tests/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/tests/run.py')
-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