Changeset 4608
- Timestamp:
- 02/26/07 06:52:01 (1 year ago)
- Files:
-
- django/trunk/django/core/management.py (modified) (1 diff)
- django/trunk/django/test/simple.py (modified) (2 diffs)
- django/trunk/docs/testing.txt (modified) (4 diffs)
- django/trunk/tests/runtests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/management.py
r4533 r4608 1241 1241 test_runner = getattr(test_module, test_path[-1]) 1242 1242 1243 test_runner(app_list, verbosity) 1243 failures = test_runner(app_list, verbosity) 1244 if failures: 1245 sys.exit(failures) 1246 1244 1247 test.help_doc = 'Runs the test suite for the specified applications, or the entire site if no apps are specified' 1245 1248 test.args = '[--verbosity] ' + APP_ARGS django/trunk/django/test/simple.py
r4541 r4608 64 64 the module. A list of 'extra' tests may also be provided; these tests 65 65 will be added to the test suite. 66 67 Returns the number of tests that failed. 66 68 """ 67 69 setup_test_environment() … … 78 80 old_name = settings.DATABASE_NAME 79 81 create_test_db(verbosity) 80 unittest.TextTestRunner(verbosity=verbosity).run(suite)82 result = unittest.TextTestRunner(verbosity=verbosity).run(suite) 81 83 destroy_test_db(old_name, verbosity) 82 84 83 85 teardown_test_environment() 86 87 return len(result.failures) 88 django/trunk/docs/testing.txt
r4529 r4608 418 418 FAILED (failures=1) 419 419 420 When the tests have all been executed, the test database is destroyed. 420 The return code for the script will indicate the number of tests that failed. 421 422 Regardless of whether the tests pass or fail, the test database is destroyed when 423 all the tests have been executed. 421 424 422 425 Using a different testing framework … … 429 432 430 433 When you run ``./manage.py test``, Django looks at the ``TEST_RUNNER`` 431 setting to determine what to do. By default, ``TEST_RUNNER`` points to ``django.test.simple.run_tests``. This method defines the default Django 434 setting to determine what to do. By default, ``TEST_RUNNER`` points to 435 ``django.test.simple.run_tests``. This method defines the default Django 432 436 testing behavior. This behavior involves: 433 437 … … 437 441 #. Looking for Unit Tests and Doctests in ``models.py`` and ``tests.py`` file for each installed application 438 442 #. Running the Unit Tests and Doctests that are found 439 #. Destroying the test database .443 #. Destroying the test database 440 444 #. Performing global post-test teardown 441 445 … … 458 462 will be printed to the console; `0` is no output, `1` is normal output, 459 463 and `2` is verbose output. 464 465 This method should return the number of tests that failed. 460 466 461 467 Testing utilities django/trunk/tests/runtests.py
r4473 r4608 125 125 # Run the test suite, including the extra validation tests. 126 126 from django.test.simple import run_tests 127 run_tests(test_models, verbosity, extra_tests=extra_tests) 127 failures = run_tests(test_models, verbosity, extra_tests=extra_tests) 128 if failures: 129 sys.exit(failures) 128 130 129 131 # Restore the old settings.
