diff --git a/.gitignore b/.gitignore index 9ea5d28..a2dd780 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ *.pyc +*.egg *.egg-info .DS_Store docs/_build /build /dist - ->>>>>>> aee2b719b27498f1b3dcbb1909a8443ff6d1cf9f diff --git a/tests/fixtures/basic.html b/bootstrapform/fixtures/basic.html similarity index 92% rename from tests/fixtures/basic.html rename to bootstrapform/fixtures/basic.html index 322806e..636dfe7 100644 --- a/tests/fixtures/basic.html +++ b/bootstrapform/fixtures/basic.html @@ -56,21 +56,21 @@
diff --git a/tests/fixtures/horizontal.html b/bootstrapform/fixtures/horizontal.html similarity index 93% rename from tests/fixtures/horizontal.html rename to bootstrapform/fixtures/horizontal.html index b255d51..e49ee15 100644 --- a/tests/fixtures/horizontal.html +++ b/bootstrapform/fixtures/horizontal.html @@ -56,21 +56,21 @@
diff --git a/tests/__init__.py b/bootstrapform/tests.py similarity index 90% rename from tests/__init__.py rename to bootstrapform/tests.py index aadc141..678dcdf 100644 --- a/tests/__init__.py +++ b/bootstrapform/tests.py @@ -1,12 +1,4 @@ import os -import sys - -os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings' - -parent = os.path.dirname(os.path.dirname( - os.path.abspath(__file__))) - -sys.path.insert(0, parent) from django.test import TestCase from django.template import Template, Context @@ -36,6 +28,8 @@ class ExampleForm(forms.Form): class BootstrapTemplateTagTests(TestCase): + maxDiff = None + def setUp(self): call_command('syncdb', interactive=False) diff --git a/runtests.py b/runtests.py new file mode 100644 index 0000000..726d4c7 --- /dev/null +++ b/runtests.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import sys +import django +from os.path import dirname, abspath + +from django.conf import settings + + + +settings.configure( + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': ':memory:' + } + }, + INSTALLED_APPS=[ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'bootstrapform', + ], + MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + ), + SITE_ID=1, + DEBUG=False, + ROOT_URLCONF='', +) + + + +def runtests(**test_args): + from django.test.utils import get_runner + + parent = dirname(abspath(__file__)) + sys.path.insert(0, parent) + + django.setup() + + TestRunner = get_runner(settings) + test_runner = TestRunner(verbosity=1, interactive=True) + failures = test_runner.run_tests(['bootstrapform'], test_args) + sys.exit(failures) + + +if __name__ == '__main__': + runtests(*sys.argv[1:]) diff --git a/setup.py b/setup.py index 04bd0e7..b4a0f61 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( author_email='tzangms@gmail.com', url='http://github.com/tzangms/django-bootstrap-form', license='BSD', - test_suite='tests', + test_suite='runtests.runtests', install_requires = [ "django>=1.3", ], diff --git a/tests/test_settings.py b/tests/test_settings.py deleted file mode 100644 index 14d0ca0..0000000 --- a/tests/test_settings.py +++ /dev/null @@ -1,41 +0,0 @@ -import os -local_path = lambda path: os.path.join(os.path.dirname(__file__), path) - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ':memory:' - } -} - -SITE_ID = 1 - -INSTALLED_APPS = [ - 'django.contrib.contenttypes', - 'django.contrib.sites', - 'django.contrib.sessions', - 'django.contrib.staticfiles', - 'django.contrib.auth', - 'django.contrib.admin', - 'bootstrapform', -] - -ROOT_URLCONF = 'tests.urls' - -MEDIA_URL = '/media/' - -MEDIA_ROOT = local_path('media') - -STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' -STATIC_ROOT = local_path('static/') -STATIC_URL = '/static/' -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder' -) - -TEMPLATE_DIRS = ( - local_path('templates'), -) - -SECRET_KEY = 'django-bootstrap-form'