Fixes Django 1.7 tests.

This commit is contained in:
Bertrand Bordage 2014-12-07 04:16:07 +01:00
parent 780c6cbdc0
commit 78332a7ef0
3 changed files with 9 additions and 0 deletions

5
benchmark.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals, print_function
@ -7,6 +8,7 @@ from time import time
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
import django
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.core.cache import get_cache
@ -176,6 +178,9 @@ def create_data(using):
if __name__ == '__main__':
if django.VERSION[:2] >= (1, 7):
django.setup()
old_db_names = {}
for alias in connections:
conn = connections[alias]

View file

@ -4,10 +4,13 @@
from __future__ import unicode_literals
import os
import sys
import django
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
if django.VERSION[:2] >= (1, 7):
django.setup()
from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner()
failures = test_runner.run_tests(['cachalot.tests'])

View file

@ -60,5 +60,6 @@ if django.VERSION < (1, 7):
INSTALLED_APPS.append('south')
MIDDLEWARE_CLASSES = ()
PASSWORD_HASHERS = ('django.contrib.auth.hashers.MD5PasswordHasher',)
SECRET_KEY = 'its not important but we have to set it'