Skip to content

Commit 286b12a

Browse files
committed
fix tests' settings
1 parent e41990a commit 286b12a

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

tests/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import os
22

3+
from django import VERSION
4+
from django.core.management import call_command
5+
36
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings')
47

5-
from django import VERSION
68

79
if VERSION >= (1, 7):
810
from django.conf import settings
911
from django.apps import apps
1012

1113
apps.populate(settings.INSTALLED_APPS)
14+
call_command('migrate', interactive=False)
15+
else:
16+
call_command('syncdb', interactive=False)
1217

13-
from django.core.management import call_command
14-
call_command('syncdb', interactive=False)
15-
16-
from django_markdown.tests import * # noqa
18+
from django_markdown.tests import * # noqa

tests/settings.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,19 @@
3838
'django.contrib.sessions.middleware.SessionMiddleware',
3939
'django.contrib.auth.middleware.AuthenticationMiddleware',
4040
)
41+
42+
TEMPLATES = [
43+
{
44+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
45+
'APP_DIRS': True,
46+
'OPTIONS': {
47+
'context_processors': [
48+
'django.template.context_processors.debug',
49+
'django.template.context_processors.request',
50+
'django.contrib.auth.context_processors.auth',
51+
'django.contrib.messages.context_processors.messages',
52+
],
53+
},
54+
55+
},
56+
]

tests/urls.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
from django.conf.urls import include, patterns
1+
from django import VERSION
2+
from django.conf.urls import include, url
23

3-
urlpatterns = patterns(
4-
'',
5-
(r'^markdown/', include('django_markdown.urls')),
6-
)
4+
if VERSION >= (1, 8):
5+
urlpatterns = [
6+
url(r'^markdown/', include('django_markdown.urls')),
7+
]
8+
else:
9+
# django <= 1.7.*
10+
from django.conf.urls import patterns
11+
urlpatterns = patterns(
12+
'',
13+
(r'^markdown/', include('django_markdown.urls')),
14+
)

0 commit comments

Comments
 (0)