summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-07-23 12:14:32 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-07-23 12:14:32 +0000
commit1b7fe09660e640bd3cdbf55d340b702d951dd22e (patch)
tree61fb2561c28724599366947f52ae47d758b71f85 /tests
parent304381616f89745c2b52ba793e5b23184c4788bb (diff)
Fixed #3771 -- Modified the test runner to observe the --noinput argument controlling script interactivity. This means that test scripts can now be put in a buildbot environment. This is a backwards incompatible change for anyone that has written a custom test runner. Thanks for the suggestion, moof@metamoof.net.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5752 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runtests.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index 7d1ee1e29c..7b52445d84 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -73,7 +73,7 @@ class InvalidModelTestCase(unittest.TestCase):
self.assert_(not unexpected, "Unexpected Errors: " + '\n'.join(unexpected))
self.assert_(not missing, "Missing Errors: " + '\n'.join(missing))
-def django_tests(verbosity, tests_to_run):
+def django_tests(verbosity, interactive, tests_to_run):
from django.conf import settings
old_installed_apps = settings.INSTALLED_APPS
@@ -130,7 +130,7 @@ def django_tests(verbosity, tests_to_run):
# Run the test suite, including the extra validation tests.
from django.test.simple import run_tests
- failures = run_tests(test_models, verbosity, extra_tests=extra_tests)
+ failures = run_tests(test_models, verbosity=verbosity, interactive=interactive, extra_tests=extra_tests)
if failures:
sys.exit(failures)
@@ -149,6 +149,8 @@ if __name__ == "__main__":
parser.add_option('-v','--verbosity', action='store', dest='verbosity', default='0',
type='choice', choices=['0', '1', '2'],
help='Verbosity level; 0=minimal output, 1=normal output, 2=all output')
+ parser.add_option('--noinput', action='store_false', dest='interactive', default=True,
+ help='Tells Django to NOT prompt the user for input of any kind.')
parser.add_option('--settings',
help='Python path to settings module, e.g. "myproject.settings". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.')
options, args = parser.parse_args()
@@ -157,4 +159,4 @@ if __name__ == "__main__":
elif "DJANGO_SETTINGS_MODULE" not in os.environ:
parser.error("DJANGO_SETTINGS_MODULE is not set in the environment. "
"Set it or use --settings.")
- django_tests(int(options.verbosity), args)
+ django_tests(int(options.verbosity), options.interactive, args)