1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #23863 -- Made runtests accept the keepdb option.

refs #20550
This commit is contained in:
Simon Charette 2014-11-16 02:01:45 +01:00 committed by Tim Graham
parent 72729f844e
commit 8330b50c85

View File

@ -198,7 +198,7 @@ def teardown(state):
setattr(settings, key, value)
def django_tests(verbosity, interactive, failfast, test_labels):
def django_tests(verbosity, interactive, failfast, keepdb, test_labels):
state = setup(verbosity, test_labels)
extra_tests = []
@ -211,6 +211,7 @@ def django_tests(verbosity, interactive, failfast, test_labels):
verbosity=verbosity,
interactive=interactive,
failfast=failfast,
keepdb=keepdb,
)
# Catch warnings thrown in test DB setup -- remove in Django 1.9
with warnings.catch_warnings():
@ -346,6 +347,9 @@ if __name__ == "__main__":
'--failfast', action='store_true', dest='failfast', default=False,
help='Tells Django to stop running the test suite after first failed '
'test.')
parser.add_argument(
'-k', '--keepdb', action='store_true', dest='keepdb', default=False,
help='Tells Django to preserve the test database between runs.')
parser.add_argument(
'--settings',
help='Python path to settings module, e.g. "myproject.settings". If '
@ -388,6 +392,7 @@ if __name__ == "__main__":
paired_tests(options.pair, options, options.modules)
else:
failures = django_tests(options.verbosity, options.interactive,
options.failfast, options.modules)
options.failfast, options.keepdb,
options.modules)
if failures:
sys.exit(bool(failures))