From 117217fd80600702c0eb9d92e2de48d2d338f410 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Wed, 12 Aug 2015 06:22:26 +0200 Subject: [PATCH] Cleanup test settings. --- runtests.py | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/runtests.py b/runtests.py index 4ab82e3..06c67ce 100644 --- a/runtests.py +++ b/runtests.py @@ -3,30 +3,39 @@ import sys from django.conf import settings -if not settings.configured: - settings.configure( - DATABASES={ - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': 'dev.db', - } +SETTINGS = { + 'DATABASES': { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'dev.db', }, - INSTALLED_APPS=[ - 'django.contrib.sessions', - 'django.contrib.staticfiles', - 'mptt', - 'dpaste', - ], - MIDDLEWARE_CLASSES=( - 'django.contrib.sessions.middleware.SessionMiddleware', - ), - STATIC_ROOT='/tmp/dpaste_test_static/', - STATIC_URL='/static/', - ROOT_URLCONF='dpaste.urls', - ) + # 'default': { + # 'ENGINE': 'django.db.backends.mysql', + # 'NAME': 'dpaste', + # 'USER': 'root', + # 'PASSWORD': '', + # } + }, + 'INSTALLED_APPS': [ + 'django.contrib.sessions', + 'django.contrib.staticfiles', + 'mptt', + 'dpaste', + ], + 'MIDDLEWARE_CLASSES': ( + 'django.contrib.sessions.middleware.SessionMiddleware', + ), + 'STATIC_ROOT': '/tmp/dpaste_test_static/', + 'STATIC_URL': '/static/', + 'ROOT_URLCONF': 'dpaste.urls' +} def runtests(*test_args): - # New Django 1.7 app registry + # Setup settings + if not settings.configured: + settings.configure(**SETTINGS) + + # New Django 1.7 app registry setup try: from django import setup setup() @@ -40,7 +49,7 @@ def runtests(*test_args): from django.test.simple import DjangoTestSuiteRunner as TestRunner test_runner = TestRunner(verbosity=1) - failures = test_runner.run_tests(['dpaste', ]) + failures = test_runner.run_tests(['dpaste']) if failures: sys.exit(failures)