paolo@lino:~/django_src/tests$ python runtests.py -v 2
Running tests with database 'postgresql'
Creating test database
The test database, django_test_db, already exists. Type 'yes' to delete it, or 'no' to cancel: yes
Traceback (most recent call last):
File "runtests.py", line 217, in ?
t.run_tests()
File "runtests.py", line 107, in run_tests
cursor.execute("DROP DATABASE %s" % TEST_DATABASE_NAME)
File "/usr/local/lib/python2.3/site-packages/django/core/db/base.py", line 10, in execute
result = self.cursor.execute(sql, params)
psycopg.ProgrammingError: ERROR: database "django_test_db" does not exist
DROP DATABASE django_test_db
Initially it says that the test database already exist, then that does not exist, and this happens because cursor.execute("CREATE DATABASE %s" % TEST_DATABASE_NAME), surrounded by a try/except (the except is naked), raises an exception (psycopg.ProgrammingError: ERROR: source database "template1" is being accessed by other users) that will remain hidden behind another kind of problem. I hope my considerations make sense.
I don't know why this exception is raised, probably it is a problem in my setup (restarting postgres makes the testsuite run fine), but it would much better if the real source of the problem could at least emerge.
Thanks