1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

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
This commit is contained in:
Russell Keith-Magee
2006-08-31 14:29:47 +00:00
parent d9883e1dec
commit fc2d5f461f
5 changed files with 171 additions and 31 deletions

View File

@@ -61,7 +61,8 @@ def run_tests(module_list, verbosity=1, extra_tests=[]):
for test in extra_tests:
suite.addTest(test)
old_name = create_test_db(verbosity)
old_name = settings.DATABASE_NAME
create_test_db(verbosity)
management.syncdb(verbosity, interactive=False)
unittest.TextTestRunner(verbosity=verbosity).run(suite)
destroy_test_db(old_name, verbosity)

View File

@@ -50,14 +50,11 @@ def create_test_db(verbosity=1, autoclobber=False):
sys.exit(1)
connection.close()
old_database_name = settings.DATABASE_NAME
settings.DATABASE_NAME = TEST_DATABASE_NAME
# Get a cursor (even though we don't need one yet). This has
# the side effect of initializing the test database.
cursor = connection.cursor()
return old_database_name
def destroy_test_db(old_database_name, verbosity=1):
# Unless we're using SQLite, remove the test database to clean up after