mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-17 04:10:24 +00:00
Update runtests.py for compatibility with Django 1.7.
This commit is contained in:
parent
8ea75e53f4
commit
739e1b169a
1 changed files with 20 additions and 15 deletions
35
runtests.py
35
runtests.py
|
|
@ -3,26 +3,31 @@
|
|||
import os, sys
|
||||
|
||||
from django.conf import settings
|
||||
import django
|
||||
|
||||
|
||||
if not settings.configured:
|
||||
settings_dict = dict(
|
||||
INSTALLED_APPS=(
|
||||
'django.contrib.contenttypes',
|
||||
'model_utils',
|
||||
'model_utils.tests',
|
||||
),
|
||||
DATABASES={
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
settings.configure(**settings_dict)
|
||||
DEFAULT_SETTINGS = dict(
|
||||
INSTALLED_APPS=(
|
||||
'django.contrib.contenttypes',
|
||||
'model_utils',
|
||||
'model_utils.tests',
|
||||
),
|
||||
DATABASES={
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3"
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def runtests(*test_args):
|
||||
if not settings.configured:
|
||||
settings.configure(**DEFAULT_SETTINGS)
|
||||
|
||||
# Compatibility with Django 1.7's stricter initialization
|
||||
if hasattr(django, 'setup'):
|
||||
django.setup()
|
||||
|
||||
if not test_args:
|
||||
test_args = ['tests']
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue