mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-05-22 03:11:51 +00:00
Updates test runner for Django 1.7, PostgreSQL & Redis.
This commit is contained in:
parent
eb471449ba
commit
3bda845310
3 changed files with 39 additions and 8 deletions
|
|
@ -14,8 +14,9 @@ Quick start
|
|||
Requirements
|
||||
............
|
||||
|
||||
Django-cachalot currently requires Django 1.6
|
||||
and `django-redis <https://github.com/niwibe/django-redis>`_ as your default
|
||||
Django-cachalot currently requires Django 1.6 or 1.7
|
||||
and `locmem <https://docs.djangoproject.com/en/1.7/topics/cache/#local-memory-caching>`_
|
||||
or `django-redis <https://github.com/niwibe/django-redis>`_ as your default
|
||||
cache backend. It should work with both Python 2 & 3.
|
||||
|
||||
Usage
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
Django>=1.6
|
||||
django-redis
|
||||
|
|
|
|||
41
runtests.py
41
runtests.py
|
|
@ -2,26 +2,55 @@
|
|||
# coding: utf-8
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import os
|
||||
import sys
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
from django.test.runner import DiscoverRunner
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'sqlite3': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
},
|
||||
'postgresql': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'cachalot',
|
||||
'USER': 'cachalot',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '5432',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
CACHES = {
|
||||
'locmem': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
},
|
||||
'redis': {
|
||||
'BACKEND': 'redis_cache.cache.RedisCache',
|
||||
'LOCATION': '127.0.0.1:6379:0',
|
||||
}
|
||||
}
|
||||
|
||||
settings.configure(
|
||||
DEBUG=True,
|
||||
DATABASES={
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
},
|
||||
},
|
||||
DATABASES={'default': DATABASES[os.environ.get('DB_BACKEND', 'sqlite3')]},
|
||||
INSTALLED_APPS=(
|
||||
'cachalot',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
),
|
||||
CACHES={'default': CACHES[os.environ.get('CACHE_BACKEND', 'locmem')]},
|
||||
MIDDLEWARE_CLASSES=(),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from django.test.runner import DiscoverRunner
|
||||
if django.VERSION[:2] >= (1, 7):
|
||||
django.setup()
|
||||
|
||||
test_runner = DiscoverRunner()
|
||||
failures = test_runner.run_tests(['cachalot'])
|
||||
if failures:
|
||||
|
|
|
|||
Loading…
Reference in a new issue