Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#964 closed defect (fixed)

python runtest.py doesn't run tests

Reported by: paolo <paolo@…> Owned by: adrian
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:

Description

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

Change History (1)

comment:1 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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