mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
Added the ability to run the tests in a standalone way.
This commit is contained in:
parent
acdd9539ae
commit
cf667a2c9d
3 changed files with 57 additions and 0 deletions
27
tests/runtests.py
Executable file
27
tests/runtests.py
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
ROOT = os.path.abspath(os.path.dirname(__file__))
|
||||
APP_ROOT = os.path.join(ROOT, '..')
|
||||
sys.path.append(APP_ROOT)
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
# We do this here because settings.py has a tendency to be imported more than
|
||||
# once, in certain situations, and we only want one temporary test folder.
|
||||
MEDIA_ROOT = os.path.join(tempfile.gettempdir(), 'avatars')
|
||||
if not os.path.exists(MEDIA_ROOT):
|
||||
os.makedirs(os.path.join(MEDIA_ROOT, 'test'))
|
||||
settings.MEDIA_ROOT = MEDIA_ROOT
|
||||
|
||||
from django.test.simple import run_tests
|
||||
|
||||
if __name__ == "__main__":
|
||||
failures = run_tests(['avatar'], verbosity=1)
|
||||
if failures:
|
||||
sys.exit(failures)
|
||||
30
tests/settings.py
Normal file
30
tests/settings.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from django.conf.urls.defaults import patterns, include, handler500, handler404
|
||||
|
||||
DEFAULT_CHARSET = 'utf-8'
|
||||
|
||||
DATABASE_ENGINE = 'sqlite3'
|
||||
DATABASE_NAME = ':memory:'
|
||||
|
||||
ROOT_URLCONF = 'settings'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
INSTALLED_APPS = (
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sites',
|
||||
'django.contrib.comments',
|
||||
'avatar',
|
||||
)
|
||||
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.app_directories.load_template_source',
|
||||
)
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^avatar/', include('avatar.urls')),
|
||||
)
|
||||
|
||||
def __exported_functionality__():
|
||||
return (handler500, handler404)
|
||||
BIN
tests/settings.pyc
Normal file
BIN
tests/settings.pyc
Normal file
Binary file not shown.
Loading…
Reference in a new issue