Kaydet (Commit) fc2d5f46 authored tarafından Russell Keith-Magee's avatar Russell Keith-Magee

Refs #2333 - Added more documentation for testing framework, and clarified some…

Refs #2333 - Added more documentation for testing framework, and clarified some code as a result of trying to describe it.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3689 bcc190cf-cafb-0310-a4f2-bffc1f526a37
üst d9883e1d
...@@ -61,7 +61,8 @@ def run_tests(module_list, verbosity=1, extra_tests=[]): ...@@ -61,7 +61,8 @@ def run_tests(module_list, verbosity=1, extra_tests=[]):
for test in extra_tests: for test in extra_tests:
suite.addTest(test) suite.addTest(test)
old_name = create_test_db(verbosity) old_name = settings.DATABASE_NAME
create_test_db(verbosity)
management.syncdb(verbosity, interactive=False) management.syncdb(verbosity, interactive=False)
unittest.TextTestRunner(verbosity=verbosity).run(suite) unittest.TextTestRunner(verbosity=verbosity).run(suite)
destroy_test_db(old_name, verbosity) destroy_test_db(old_name, verbosity)
...@@ -50,14 +50,11 @@ def create_test_db(verbosity=1, autoclobber=False): ...@@ -50,14 +50,11 @@ def create_test_db(verbosity=1, autoclobber=False):
sys.exit(1) sys.exit(1)
connection.close() connection.close()
old_database_name = settings.DATABASE_NAME
settings.DATABASE_NAME = TEST_DATABASE_NAME settings.DATABASE_NAME = TEST_DATABASE_NAME
# Get a cursor (even though we don't need one yet). This has # Get a cursor (even though we don't need one yet). This has
# the side effect of initializing the test database. # the side effect of initializing the test database.
cursor = connection.cursor() cursor = connection.cursor()
return old_database_name
def destroy_test_db(old_database_name, verbosity=1): def destroy_test_db(old_database_name, verbosity=1):
# Unless we're using SQLite, remove the test database to clean up after # Unless we're using SQLite, remove the test database to clean up after
......
...@@ -345,6 +345,17 @@ setting the Python path for you. ...@@ -345,6 +345,17 @@ setting the Python path for you.
Displays a help message that includes a terse list of all available actions and Displays a help message that includes a terse list of all available actions and
options. options.
--noinput
---------
Inform django-admin that the user should NOT be prompted for any input. Useful if
the django-admin script will be executed as an unattended, automated script.
--noreload
----------
Disable the use of the auto-reloader when running the development server.
--version --version
--------- ---------
...@@ -355,6 +366,17 @@ Example output:: ...@@ -355,6 +366,17 @@ Example output::
0.9.1 0.9.1
0.9.1 (SVN) 0.9.1 (SVN)
--verbosity
-----------
Example usage::
django-admin.py syncdb --verbosity=2
Verbosity determines the amount of notification and debug information that
will be printed to the console. '0' is no output, '1' is normal output,
and `2` is verbose output.
Extra niceties Extra niceties
============== ==============
......
...@@ -754,6 +754,18 @@ misspelled) variables. See `How invalid variables are handled`_. ...@@ -754,6 +754,18 @@ misspelled) variables. See `How invalid variables are handled`_.
.. _How invalid variables are handled: http://www.djangoproject.com/documentation/templates_python/#how-invalid-variables-are-handled .. _How invalid variables are handled: http://www.djangoproject.com/documentation/templates_python/#how-invalid-variables-are-handled
TEST_RUNNER
-----------
**New in Django development version**
Default: ``'django.test.simple.run_tests'``
The name of the method to use for starting the test suite. See
`Testing Django Applications`_.
.. _Testing Django Applications: ../testing/
TIME_FORMAT TIME_FORMAT
----------- -----------
......
This diff is collapsed.
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