diff options
| author | David Cramer | 2011-06-14 12:38:55 -0700 |
|---|---|---|
| committer | David Cramer | 2011-06-14 12:38:55 -0700 |
| commit | 4ee67a1632f41a873d997ae15ac0a2eccca04430 (patch) | |
| tree | 8ee7b6fca627ae86356aa9f22002f2ada069c52b | |
| parent | c61daab0ce10d9654ecb9ce70819233171885eae (diff) | |
| download | django-debug-toolbar-4ee67a1632f41a873d997ae15ac0a2eccca04430.tar.bz2 | |
Move test suite into parent namespace
| -rw-r--r-- | debug_toolbar/tests/__init__.py | 1 | ||||
| -rw-r--r-- | runtests.py (renamed from debug_toolbar/runtests.py) | 19 | ||||
| -rw-r--r-- | setup.py | 4 | ||||
| -rw-r--r-- | tests/__init__.py (renamed from debug_toolbar/tests/templates/404.html) | 0 | ||||
| -rw-r--r-- | tests/models.py | 0 | ||||
| -rw-r--r-- | tests/templates/404.html | 0 | ||||
| -rw-r--r-- | tests/tests.py (renamed from debug_toolbar/tests/tests.py) | 12 | ||||
| -rw-r--r-- | tests/urls.py (renamed from debug_toolbar/tests/urls.py) | 2 | ||||
| -rw-r--r-- | tests/views.py (renamed from debug_toolbar/tests/views.py) | 0 |
9 files changed, 20 insertions, 18 deletions
diff --git a/debug_toolbar/tests/__init__.py b/debug_toolbar/tests/__init__.py deleted file mode 100644 index f853b10..0000000 --- a/debug_toolbar/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from tests import *
\ No newline at end of file diff --git a/debug_toolbar/runtests.py b/runtests.py index f16882a..b8abc5d 100644 --- a/debug_toolbar/runtests.py +++ b/runtests.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys from os.path import dirname, abspath +from optparse import OptionParser from django.conf import settings @@ -19,29 +20,31 @@ if not settings.configured: 'debug_toolbar', - 'debug_toolbar.tests', + 'tests', ], ROOT_URLCONF='', DEBUG=False, SITE_ID=1, ) - import djcelery - djcelery.setup_loader() from django.test.simple import run_tests -def runtests(*test_args): +def runtests(*test_args, **kwargs): if 'south' in settings.INSTALLED_APPS: from south.management.commands import patch_for_test_db_setup patch_for_test_db_setup() if not test_args: - test_args = ['debug_toolbar'] + test_args = ['tests'] parent = dirname(abspath(__file__)) sys.path.insert(0, parent) - failures = run_tests(test_args, verbosity=1, interactive=True) + failures = run_tests(test_args, verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast')) sys.exit(failures) - if __name__ == '__main__': - runtests(*sys.argv[1:])
\ No newline at end of file + parser = OptionParser() + parser.add_option('--failfast', action='store_true', default=False, dest='failfast') + + (options, args) = parser.parse_args() + + runtests(failfast=options.failfast, *args)
\ No newline at end of file @@ -11,12 +11,12 @@ setup( url='https://github.com/django-debug-toolbar/django-debug-toolbar', download_url='https://github.com/django-debug-toolbar/django-debug-toolbar/downloads', license='BSD', - packages=find_packages(exclude=['ez_setup']), + packages=find_packages(exclude=('ez_setup', 'tests', 'example')), tests_require=[ 'django>=1.1,<1.4', 'dingus', ], - test_suite='debug_toolbar.runtests.runtests', + test_suite='runtests.runtests', include_package_data=True, zip_safe=False, # because we're including media that Django needs classifiers=[ diff --git a/debug_toolbar/tests/templates/404.html b/tests/__init__.py index e69de29..e69de29 100644 --- a/debug_toolbar/tests/templates/404.html +++ b/tests/__init__.py diff --git a/tests/models.py b/tests/models.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/models.py diff --git a/tests/templates/404.html b/tests/templates/404.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/templates/404.html diff --git a/debug_toolbar/tests/tests.py b/tests/tests.py index 3fc2aff..31b96c8 100644 --- a/debug_toolbar/tests/tests.py +++ b/tests/tests.py @@ -43,7 +43,7 @@ class BaseTestCase(TestCase): self.toolbar = toolbar class DebugToolbarTestCase(BaseTestCase): - urls = 'debug_toolbar.tests.urls' + urls = 'tests.urls' def test_middleware(self): resp = self.client.get('/execute_sql/') @@ -86,7 +86,7 @@ class DebugToolbarTestCase(BaseTestCase): def test_request_urlconf_string(self): request = self.request - request.urlconf = 'debug_toolbar.tests.urls' + request.urlconf = 'tests.urls' request.META = {'REMOTE_ADDR': '127.0.0.1'} middleware = DebugToolbarMiddleware() @@ -97,12 +97,12 @@ class DebugToolbarTestCase(BaseTestCase): self.assertTrue(hasattr(request.urlconf.urlpatterns[0], '_callback_str')) self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, 'debug_toolbar.views.debug_media') - self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'debug_toolbar.tests.urls') + self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'tests.urls') def test_request_urlconf_string_per_request(self): request = self.request - request.urlconf = 'debug_toolbar.tests.urls' + request.urlconf = 'tests.urls' request.META = {'REMOTE_ADDR': '127.0.0.1'} middleware = DebugToolbarMiddleware() @@ -120,7 +120,7 @@ class DebugToolbarTestCase(BaseTestCase): def test_request_urlconf_module(self): request = self.request - request.urlconf = __import__('debug_toolbar.tests.urls').tests.urls + request.urlconf = __import__('tests.urls').urls request.META = {'REMOTE_ADDR': '127.0.0.1'} middleware = DebugToolbarMiddleware() @@ -131,7 +131,7 @@ class DebugToolbarTestCase(BaseTestCase): self.assertTrue(hasattr(request.urlconf.urlpatterns[0], '_callback_str')) self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, 'debug_toolbar.views.debug_media') - self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'debug_toolbar.tests.urls') + self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'tests.urls') class SQLPanelTestCase(BaseTestCase): def test_recording(self): diff --git a/debug_toolbar/tests/urls.py b/tests/urls.py index 7c99b03..d1cb07f 100644 --- a/debug_toolbar/tests/urls.py +++ b/tests/urls.py @@ -10,5 +10,5 @@ from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', - url(r'^execute_sql/$', 'debug_toolbar.tests.views.execute_sql'), + url(r'^execute_sql/$', 'tests.views.execute_sql'), ) diff --git a/debug_toolbar/tests/views.py b/tests/views.py index f989dcd..f989dcd 100644 --- a/debug_toolbar/tests/views.py +++ b/tests/views.py |
