Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 57 lines (45 sloc) 1.649 kB
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
1 #!/usr/bin/env python
2 import sys
3 from os.path import dirname, abspath
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
4 from optparse import OptionParser
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
5
7047361 @bkonkle Add the debug_toolbar middleware to the runtests settings
bkonkle authored
6 from django.conf import settings, global_settings
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
7
8 if not settings.configured:
9 settings.configure(
01cd085 @dcramer pep8
dcramer authored
10 DATABASES={
f9e17db Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE'
pzinovkin authored
11 'default': {
12 'ENGINE': 'django.db.backends.sqlite3',
13 }
14 },
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
15 INSTALLED_APPS=[
16 'django.contrib.auth',
17 'django.contrib.admin',
18 'django.contrib.contenttypes',
19 'django.contrib.sessions',
20 'django.contrib.sites',
01cd085 @dcramer pep8
dcramer authored
21
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
22 'debug_toolbar',
01cd085 @dcramer pep8
dcramer authored
23
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
24 'tests',
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
25 ],
01cd085 @dcramer pep8
dcramer authored
26 MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
7047361 @bkonkle Add the debug_toolbar middleware to the runtests settings
bkonkle authored
27 'debug_toolbar.middleware.DebugToolbarMiddleware',
28 ),
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
29 ROOT_URLCONF='',
30 DEBUG=False,
31 SITE_ID=1,
32 )
33
f9e17db Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE'
pzinovkin authored
34 from django.test.simple import DjangoTestSuiteRunner
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
35
01cd085 @dcramer pep8
dcramer authored
36
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
37 def runtests(*test_args, **kwargs):
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
38 if 'south' in settings.INSTALLED_APPS:
39 from south.management.commands import patch_for_test_db_setup
40 patch_for_test_db_setup()
01cd085 @dcramer pep8
dcramer authored
41
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
42 if not test_args:
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
43 test_args = ['tests']
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
44 parent = dirname(abspath(__file__))
45 sys.path.insert(0, parent)
f9e17db Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE'
pzinovkin authored
46 test_runner = DjangoTestSuiteRunner(verbosity=kwargs.get('verbosity', 1), interactive=kwargs.get('interactive', False), failfast=kwargs.get('failfast'))
47 failures = test_runner.run_tests(test_args)
f492b56 @dcramer Some initial tests and fix for execution model
dcramer authored
48 sys.exit(failures)
49
50 if __name__ == '__main__':
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
51 parser = OptionParser()
52 parser.add_option('--failfast', action='store_true', default=False, dest='failfast')
01cd085 @dcramer pep8
dcramer authored
53
4ee67a1 @dcramer Move test suite into parent namespace
dcramer authored
54 (options, args) = parser.parse_args()
01cd085 @dcramer pep8
dcramer authored
55
f9e17db Fix for error 'Settings' object has no attribute 'DATABASE_ENGINE'
pzinovkin authored
56 runtests(failfast=options.failfast, *args)
Something went wrong with that request. Please try again.