~ubuntu-branches/ubuntu/quantal/python-django/quantal

« back to all changes in this revision

Viewing changes to django/core/management/commands/test.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-07-29 11:26:28 UTC
  • mfrom: (1.1.8 upstream) (4.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090729112628-pg09ino8sz0sj21t
Tags: 1.1-1
* New upstream release.
* Merge from experimental:
  - Ship FastCGI initscript and /etc/default file in python-django's examples
    directory (Closes: #538863)
  - Drop "05_10539-sphinx06-compatibility.diff"; it has been applied
    upstream.
  - Bump Standards-Version to 3.8.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
class Command(BaseCommand):
6
6
    option_list = BaseCommand.option_list + (
7
 
        make_option('--verbosity', action='store', dest='verbosity', default='1',
8
 
            type='choice', choices=['0', '1', '2'],
9
 
            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
10
7
        make_option('--noinput', action='store_false', dest='interactive', default=True,
11
8
            help='Tells Django to NOT prompt the user for input of any kind.'),
12
9
    )
17
14
 
18
15
    def handle(self, *test_labels, **options):
19
16
        from django.conf import settings
 
17
        from django.test.utils import get_runner
20
18
 
21
19
        verbosity = int(options.get('verbosity', 1))
22
20
        interactive = options.get('interactive', True)
23
 
    
24
 
        test_path = settings.TEST_RUNNER.split('.')
25
 
        # Allow for Python 2.5 relative paths
26
 
        if len(test_path) > 1:
27
 
            test_module_name = '.'.join(test_path[:-1])
28
 
        else:
29
 
            test_module_name = '.'
30
 
        test_module = __import__(test_module_name, {}, {}, test_path[-1])
31
 
        test_runner = getattr(test_module, test_path[-1])
 
21
        test_runner = get_runner(settings)
32
22
 
33
23
        failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive)
34
24
        if failures: