Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#964 closed defect (fixed)

python doesn't run tests

Reported by: paolo <paolo@…> Owned by: Adrian Holovaty
Component: Tools Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


paolo@lino:~/django_src/tests$ python -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 "", line 217, in ?
  File "", line 107, in run_tests
    cursor.execute("DROP DATABASE %s" % TEST_DATABASE_NAME)
  File "/usr/local/lib/python2.3/site-packages/django/core/db/", 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.


Change History (1)

comment:1 Changed 12 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [1520]) Fixed #964 -- Added helpful error message if there's a problem in running the unit tests. Thanks, paolo.

Note: See TracTickets for help on using tickets.
Back to Top