Fixed #964 -- Added helpful error message if there's a problem in running the unit tests. Thanks, paolo.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1520 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-12-01 06:39:39 +00:00
parent 3bf29d2184
commit e7e991e86b
1 changed files with 3 additions and 2 deletions

View File

@ -100,8 +100,9 @@ class TestRunner:
self.output(1, "Creating test database")
try:
cursor.execute("CREATE DATABASE %s" % TEST_DATABASE_NAME)
except:
confirm = raw_input("The test database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_DATABASE_NAME)
except Exception, e:
sys.stderr.write("Got an error creating the test database: %s\n" % e)
confirm = raw_input("It appears the test database, %s, already exists. Type 'yes' to delete it, or 'no' to cancel: " % TEST_DATABASE_NAME)
if confirm == 'yes':
cursor.execute("DROP DATABASE %s" % TEST_DATABASE_NAME)
cursor.execute("CREATE DATABASE %s" % TEST_DATABASE_NAME)