1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
# Description: Fix some incompatibilities with Django 1.4.
# Author: Bernhard Reiter <ockham@raz.or.at>
# Forwarded: http://code.google.com/p/django-voting/issues/detail?id=35
--- a/voting/tests/settings.py
+++ b/voting/tests/settings.py
@@ -2,8 +2,12 @@
DIRNAME = os.path.dirname(__file__)
-DATABASE_ENGINE = 'sqlite3'
-DATABASE_NAME = os.path.join(DIRNAME, 'database.db')
+DATABASES = {
+ 'default' : {
+ 'ENGINE' : 'django.db.backends.sqlite3',
+ 'NAME' : os.path.join(DIRNAME, 'database.db'),
+ }
+}
#DATABASE_ENGINE = 'mysql'
#DATABASE_NAME = 'tagging_test'
--- a/voting/tests/runtests.py
+++ b/voting/tests/runtests.py
@@ -1,8 +1,9 @@
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'voting.tests.settings'
-from django.test.simple import run_tests
+from django.test.simple import DjangoTestSuiteRunner
-failures = run_tests(None, verbosity=9)
+runner = DjangoTestSuiteRunner(verbosity=9)
+failures = runner.run_tests(None)
if failures:
sys.exit(failures)
--- a/voting/managers.py
+++ b/voting/managers.py
@@ -138,7 +138,7 @@
# MySQL has issues with re-using the aggregate function in the
# HAVING clause, so we alias the score and use this alias for
# its benefit.
- if settings.DATABASE_ENGINE == 'mysql':
+ if settings.DATABASES['default']['ENGINE'] == 'mysql':
having_score = connection.ops.quote_name('score')
else:
having_score = 'SUM(vote)'
|