diff options
author | Max Peterson <max@incuna.com> | 2015-11-30 15:56:27 +0000 |
---|---|---|
committer | Max Peterson <max@incuna.com> | 2015-11-30 15:56:27 +0000 |
commit | 1a849e356d1c2487337c62768f16ea80883c9bf1 (patch) | |
tree | 471559ca53f6f77cd1677921d987628254d4f59e /wkhtmltopdf/tests/run.py | |
parent | 5bff981f7075ed91da712ceba42095ea1e3f884a (diff) | |
parent | 8224c46c84bc0d25c36d49d13610e8c4d02e2c5c (diff) | |
download | django-wkhtmltopdf-1a849e356d1c2487337c62768f16ea80883c9bf1.tar.gz django-wkhtmltopdf-1a849e356d1c2487337c62768f16ea80883c9bf1.tar.bz2 django-wkhtmltopdf-1a849e356d1c2487337c62768f16ea80883c9bf1.zip |
Merge pull request #94 from timb07/master
Enable tests to run with Django >= 1.7 and silence warnings
Diffstat (limited to 'wkhtmltopdf/tests/run.py')
-rw-r--r-- | wkhtmltopdf/tests/run.py | 12 |
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 |