mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for contrib.admin. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,20 +1,32 @@
|
||||
import sys
|
||||
import os
|
||||
from optparse import make_option, OptionParser
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
from optparse import make_option, OptionParser
|
||||
import sys
|
||||
from django.test.utils import get_runner
|
||||
|
||||
class Command(BaseCommand):
|
||||
option_list = BaseCommand.option_list + (
|
||||
make_option('--noinput', action='store_false', dest='interactive', default=True,
|
||||
make_option('--noinput',
|
||||
action='store_false', dest='interactive', default=True,
|
||||
help='Tells Django to NOT prompt the user for input of any kind.'),
|
||||
make_option('--failfast', action='store_true', dest='failfast', default=False,
|
||||
help='Tells Django to stop running the test suite after first failed test.'),
|
||||
make_option('--testrunner', action='store', dest='testrunner',
|
||||
help='Tells Django to use specified test runner class instead of the one '+
|
||||
'specified by the TEST_RUNNER setting.')
|
||||
make_option('--failfast',
|
||||
action='store_true', dest='failfast', default=False,
|
||||
help='Tells Django to stop running the test suite after first '
|
||||
'failed test.'),
|
||||
make_option('--testrunner',
|
||||
action='store', dest='testrunner',
|
||||
help='Tells Django to use specified test runner class instead of '
|
||||
'the one specified by the TEST_RUNNER setting.'),
|
||||
make_option('--liveserver',
|
||||
action='store', dest='liveserver', default=None,
|
||||
help='Overrides the default address where the live server (used '
|
||||
'with LiveServerTestCase) is expected to run from. The '
|
||||
'default value is localhost:8081.'),
|
||||
)
|
||||
help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.'
|
||||
help = ('Runs the test suite for the specified applications, or the '
|
||||
'entire site if no apps are specified.')
|
||||
args = '[appname ...]'
|
||||
|
||||
requires_model_validation = False
|
||||
@@ -35,7 +47,8 @@ class Command(BaseCommand):
|
||||
|
||||
def create_parser(self, prog_name, subcommand):
|
||||
test_runner_class = get_runner(settings, self.test_runner)
|
||||
options = self.option_list + getattr(test_runner_class, 'option_list', ())
|
||||
options = self.option_list + getattr(
|
||||
test_runner_class, 'option_list', ())
|
||||
return OptionParser(prog=prog_name,
|
||||
usage=self.usage(subcommand),
|
||||
version=self.get_version(),
|
||||
@@ -48,6 +61,10 @@ class Command(BaseCommand):
|
||||
TestRunner = get_runner(settings, options.get('testrunner'))
|
||||
options['verbosity'] = int(options.get('verbosity'))
|
||||
|
||||
if options.get('liveserver') is not None:
|
||||
os.environ['DJANGO_LIVE_TEST_SERVER_ADDRESS'] = options['liveserver']
|
||||
del options['liveserver']
|
||||
|
||||
test_runner = TestRunner(**options)
|
||||
failures = test_runner.run_tests(test_labels)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user