Commits

Anonymous committed 52271a3

less fragile test runner

Comments (0)

Files changed (4)

lockdown/tests/runtests.py

-#!/usr/bin/env python
-
-from os.path import dirname, abspath
-import sys
-
-def runtests(*test_args):
-    if not test_args:
-        test_args = ['lockdown']
-    parent = dirname(dirname(dirname(abspath(__file__))))
-    sys.path.insert(0, parent)
-    from django.test.simple import run_tests
-    failures = run_tests(test_args, verbosity=1, interactive=True)
-    sys.exit(failures)
-
-
-if __name__ == '__main__':
-    runtests(*sys.argv[1:])

lockdown/tests/tests.py

 import datetime
 import os
 
+from django.test import TestCase
 from django.conf import settings as django_settings
 
-if not django_settings.configured:
-    django_settings.configure(
-        DATABASE_ENGINE='sqlite3',
-        INSTALLED_APPS=(
-            'django.contrib.sessions',
-            'django.contrib.contenttypes',
-            'django.contrib.auth',
-            'lockdown',
-        ),
-        ROOT_URLCONF='lockdown.tests.urls',
-    )
-
-from django.test import TestCase
-
 from lockdown import settings, middleware
 from lockdown.forms import AuthForm
 
+#!/usr/bin/env python
+
+from os.path import dirname, abspath
+import sys
+
+from django.conf import settings as django_settings
+
+if not django_settings.configured:
+    django_settings.configure(
+        DATABASE_ENGINE='sqlite3',
+        INSTALLED_APPS=(
+            'django.contrib.sessions',
+            'django.contrib.contenttypes',
+            'django.contrib.auth',
+            'lockdown',
+        ),
+        ROOT_URLCONF='lockdown.tests.urls',
+    )
+
+def runtests(*test_args):
+    if not test_args:
+        test_args = ['lockdown']
+    parent = dirname(dirname(dirname(abspath(__file__))))
+    sys.path.insert(0, parent)
+    from django.test.simple import run_tests
+    failures = run_tests(test_args, verbosity=1, interactive=True)
+    sys.exit(failures)
+
+
+if __name__ == '__main__':
+    runtests(*sys.argv[1:])
         'Framework :: Django',
     ],
     zip_safe=False,
-    test_suite='lockdown.tests.runtests.runtests',
+    test_suite='runtests.runtests',
     package_data={'lockdown': ['templates/lockdown/*.html',
                                'tests/templates/lockdown/*.html']},
 )