Commit f45127a4 authored by Vladimir Rusinov's avatar Vladimir Rusinov

Add config for running tests using django-nose.

parent 7295832f
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Django settings for running testsuite using django-nose.
Django-nose have some advantages over default django test suite, most notable
are:
- It will testing just your weblate by default, not all the standard things
that happen to be in INSTALLED_APPS. On my installation many django tests
fail for unrelated to weblate reasons.
- It will let more precise specification of what tests to run.
"""
from weblate.settings_example import *
import os
if 'TRAVIS_DATABASE' in os.environ:
if os.environ['TRAVIS_DATABASE'] == 'mysql':
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'root'
DATABASES['default']['PASSWORD'] = ''
elif os.environ['TRAVIS_DATABASE'] == 'postgresql':
DATABASES['default']['ENGINE'] = \
'django.db.backends.postgresql_psycopg2'
DATABASES['default']['NAME'] = 'weblate'
DATABASES['default']['USER'] = 'postgres'
DATABASES['default']['PASSWORD'] = ''
# Configure admins
ADMINS = (('Weblate test', 'noreply@weblate.org'), )
# Different root for test repos
GIT_ROOT = '%s/test-repos/' % WEB_ROOT
# Avoid migrating during testsuite
SOUTH_TESTS_MIGRATE = False
# Fake access to Microsoft Translator
MT_MICROSOFT_ID = 'ID'
MT_MICROSOFT_SECRET = 'SECRET'
# Fake Google translate API key
MT_GOOGLE_KEY = 'KEY'
# To get higher limit for testing
MT_MYMEMORY_EMAIL = 'test@weblate.org'
# Enable some machine translations
MACHINE_TRANSLATION_SERVICES = (
'weblate.trans.machine.microsoft.MicrosoftTranslation',
'weblate.trans.machine.dummy.DummyTranslation',
)
# Silent logging setup
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
'weblate': {
'handlers': [],
'level': 'ERROR',
}
}
}
INSTALLED_APPS = INSTALLED_APPS + ('django_nose', )
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment