From cf667a2c9df0ec7814d7ff68dae77d50109bc5a0 Mon Sep 17 00:00:00 2001 From: Eric Florenzano Date: Mon, 22 Feb 2010 17:52:01 -0500 Subject: [PATCH] Added the ability to run the tests in a standalone way. --- tests/runtests.py | 27 +++++++++++++++++++++++++++ tests/settings.py | 30 ++++++++++++++++++++++++++++++ tests/settings.pyc | Bin 0 -> 1260 bytes 3 files changed, 57 insertions(+) create mode 100755 tests/runtests.py create mode 100644 tests/settings.py create mode 100644 tests/settings.pyc diff --git a/tests/runtests.py b/tests/runtests.py new file mode 100755 index 0000000..c9e375a --- /dev/null +++ b/tests/runtests.py @@ -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) \ No newline at end of file diff --git a/tests/settings.py b/tests/settings.py new file mode 100644 index 0000000..73ca330 --- /dev/null +++ b/tests/settings.py @@ -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) \ No newline at end of file diff --git a/tests/settings.pyc b/tests/settings.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0af4d47bcf337f2cb495eaeeb21d54c158eedb42 GIT binary patch literal 1260 zcmc&zUvHE^5FfZJt^KcUW7Oz_PrMYGSQFDUM(k0&c;yvGC$zB^7B~ezKVy3YMAF>dilj5|r(z2jB`(&X+ z%*q0B_;s} zfvIZanM&)oqQfhb=M8}lZ|xK0tZZ3l=_oI4AsSl0cf77N_1BZ{|jL_Bdo2~U$bVe^6}^q zi&;O8TDB}9M@f?t`m6+BaWi9u)_B`<51o@i7$3ZM{J;$_F(-81I)NLz-n+i%(u%U1 zVxDv4(y|IP9ES0UKR6hAhwZ%y`k@>5d!(}IdqL<725v8Qj*kOcXDD=!jt35#42Dk6 z^#f9!#Vs|xufDo(|E5z^