Commits

Carl Meyer  committed 310f3d2

Added tox.ini and fixed test-runner for compatibility with Django 1.0-trunk.

  • Participants
  • Parent commits a5d7fcf

Comments (0)

Files changed (3)

 ^dist/
 ^django_localeurl.egg-info/
 ^HGREV$
+^\.tox/
 from os.path import dirname, abspath
 import sys
 
-from django.conf import settings as django_settings
+from django.conf import settings
 
-if not django_settings.configured:
-    django_settings.configure(
-        DATABASE_ENGINE='sqlite3',
+if not settings.configured:
+    from django import VERSION
+    settings_dict = dict(
         INSTALLED_APPS=(
             'localeurl',
-        ),
+            ),
         ROOT_URLCONF='localeurl.tests.test_urls',
-    )
+        )
+    if VERSION >= (1, 2):
+        settings_dict["DATABASES"] = {
+            "default": {
+                "ENGINE": "django.db.backends.sqlite3"
+                }}
+    else:
+        settings_dict["DATABASE_ENGINE"] = "sqlite3"
+
+    settings.configure(**settings_dict)
+
 
 def runtests(*test_args):
     if not test_args:
         test_args = ['localeurl']
     parent = dirname(abspath(__file__))
     sys.path.insert(0, parent)
-    from django.test.simple import run_tests
+    try:
+        from django.test.simple import DjangoTestSuiteRunner
+        def run_tests(test_args, verbosity, interactive):
+            runner = DjangoTestSuiteRunner(
+                verbosity=verbosity, interactive=interactive)
+            return runner.run_tests(test_args)
+    except ImportError:
+        # for Django versions that don't have DjangoTestSuiteRunner
+        from django.test.simple import run_tests
     failures = run_tests(test_args, verbosity=1, interactive=True)
     sys.exit(failures)
 
+[tox]
+envlist=py24-1.0,py24-1.1,py24-1.2,py25-1.0,py25-1.1,py25-1.2,py25,py25-trunk,py26-1.0,py26-1.1,py26-1.2,py26,py26-trunk,py27-1.0,py27-1.1,py27-1.2,py27,py27-trunk
+
+[testenv]
+deps=
+  django==1.3
+commands=python setup.py test
+
+[testenv:py24-1.0]
+basepython=python2.4
+deps=
+  django==1.0.4
+  pysqlite==2.6.3
+
+[testenv:py24-1.1]
+basepython=python2.4
+deps=
+  django==1.1.4
+  pysqlite==2.6.3
+
+[testenv:py24-1.2]
+basepython=python2.4
+deps=
+  django==1.2.5
+  pysqlite==2.6.3
+
+[testenv:py25-1.0]
+basepython=python2.5
+deps=
+  django==1.0.4
+
+[testenv:py25-1.1]
+basepython=python2.5
+deps=
+  django==1.1.4
+
+[testenv:py25-1.2]
+basepython=python2.5
+deps=
+  django==1.2.5
+
+[testenv:py25-trunk]
+basepython=python2.5
+deps=
+  svn+http://code.djangoproject.com/svn/django/trunk#egg=django
+
+[testenv:py26-1.0]
+basepython=python2.6
+deps=
+  django==1.0.4
+
+[testenv:py26-1.1]
+basepython=python2.6
+deps=
+  django==1.1.4
+
+[testenv:py26-1.2]
+basepython=python2.6
+deps=
+  django==1.2.5
+
+[testenv:py26-trunk]
+basepython=python2.6
+deps=
+  svn+http://code.djangoproject.com/svn/django/trunk#egg=django
+
+[testenv:py27-1.0]
+basepython=python2.7
+deps=
+  django==1.0.4
+
+[testenv:py27-1.1]
+basepython=python2.7
+deps=
+  django==1.1.4
+
+[testenv:py27-1.2]
+basepython=python2.7
+deps=
+  django==1.2.5
+
+[testenv:py27-trunk]
+basepython=python2.7
+deps=
+  svn+http://code.djangoproject.com/svn/django/trunk#egg=django