Kaydet (Commit) 5dd6bbd2 authored tarafından Gary Wilson Jr's avatar Gary Wilson Jr

Fixed #11615 -- Changed test runners to use an exit status code of 1 for any…

Fixed #11615 -- Changed test runners to use an exit status code of 1 for any number of failed tests.  The previous behavior of using an exit status code equal to the number of failed tests produced incorrect exit status codes when the number of test failures was 256 or greater.  Thanks to lamby for the report and patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@12068 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst a5fc65b4
......@@ -31,4 +31,4 @@ class Command(BaseCommand):
failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive)
if failures:
sys.exit(failures)
sys.exit(bool(failures))
......@@ -232,6 +232,16 @@ party packages, or that you wrote yourself, you should ensure that the
information, see
:ref:`template tag thread safety considerations<template_tag_thread_safety>`.
Test runner exit status code
----------------------------
The exit status code of the test runners (``tests/runtests.py`` and ``python
manage.py test``) no longer represents the number of failed tests, since a
failure of 256 or more tests resulted in a wrong exit status code. The exit
status code for the test runner is now 0 for success (no failing tests) and 1
for any number of test failures. If needed, the number of test failures can be
found at the end of the test runner's output.
.. _deprecated-features-1.2:
Features deprecated in 1.2
......
......@@ -162,7 +162,7 @@ def django_tests(verbosity, interactive, failfast, test_labels):
failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive, failfast=failfast,
extra_tests=extra_tests)
if failures:
sys.exit(failures)
sys.exit(bool(failures))
# Restore the old settings.
settings.INSTALLED_APPS = old_installed_apps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment