Opened 6 months ago

Closed 6 months ago

#21222 closed Cleanup/optimization (fixed)

document that ./ must use different databases for 'default' and 'other'.

Reported by: vernondcole Owned by: nobody
Component: Testing framework Version: master
Severity: Normal Keywords: runtests infinite wait
Cc: vernondcole Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I decided to get off my duff and start testing django-mssql using django 1.6 -- to see whether that 1.6 compatible code I put in really works.

The first step is to get a set of baseline runs of the test suite.

I checked out the git master & did ./ --settings=test_sqlite ... everything great.
Ran 6211 tests in 263.111s
OK (skipped=331, expected failures=11)

I made another setting like this:


'default': {

'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adotest',
'USER': 'adotestuser',
'PASSWORD': '12345678',
'HOST': 'localhost',

'autocommit': True, # should be ignored in django 1.6


'other': {

'ENGINE': 'django.db.backends.sqlite3',



$ ./ --settings=test_pg_lite
Ran 6211 tests in 680.520s
OK (skipped=249, expected failures=11)

So lets try with both databases using PostgresSQL...


'default': {

'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adotest',
'USER': 'adotestuser',
'PASSWORD': '12345678',
'HOST': 'localhost',

'autocommit': True,


'other': {

'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adotest',
## 'TEST_NAME': 'other_test',
'USER': 'adotestuser',
'PASSWORD': '12345678',
'HOST': 'localhost',

'autocommit': True,



$ ./ --settings=test_pg

<It prints a screenfull of dots and then stops. I left it running all night -- no progress.>
<After several retries, I found that if I kill the PostgreSQL instance I get...>
Ran 4826 tests in 1489.312s
FAILED (failures=27, errors=1482, skipped=239, expected failures=10)

The first of the 1482 tracebacks after I killed the server was:

ERROR: test_fixture_loading (multiple_database.tests.FixtureTestCase)
Multi-db fixtures are loaded correctly
Traceback (most recent call last):

File "/home/vernon/PycharmProjects/django/django/test/", line 173, in call


File "/home/vernon/PycharmProjects/django/django/test/", line 719, in _pre_setup


File "/home/vernon/PycharmProjects/django/django/test/", line 853, in _fixture_setup


File "/home/vernon/PycharmProjects/django/django/test/", line 865, in _fixture_teardown

self.atomics[db_name].exit(None, None, None)

File "/home/vernon/PycharmProjects/django/django/db/", line 352, in exit


File "/home/vernon/PycharmProjects/django/django/db/backends/", line 335, in set_autocommit


File "/home/vernon/PycharmProjects/django/django/db/backends/postgresql_psycopg2/", line 186, in _set_autocommit

self.connection.autocommit = autocommit

InterfaceError: connection already closed

Was it me being clumsy, or is this a major bug?

Attachments (0)

Change History (4)

comment:1 Changed 6 months ago by akaariai

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

You have two connections to the same DB, and for that reason you are likely ending up in some sort of deadlock. Maybe having more than one connection to the same DB shouldn't validate, but other than that this doesn't seem like a bug at all.

Can you confirm that changing the 'other' alias to use different database (different NAME) fixes the issue?

comment:2 Changed 6 months ago by aaugustin

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

Using a different NAME works, the CI tests it.

comment:3 Changed 6 months ago by vernondcole

  • Cc vernondcole added
  • Component changed from Uncategorized to Testing framework
  • Resolution invalid deleted
  • Severity changed from Release blocker to Normal
  • Status changed from closed to new
  • Summary changed from ./ with two Postgress databases hangs infinitly. Did I just discover a 1.6 release blocker, or am I doing something wrong? to document that ./ must use different databases for 'default' and 'other'.
  • Type changed from Uncategorized to Cleanup/optimization

At the very least, this setup restriction should be documented so that some other geek does not repeat my error. I will see whether there is an easy place in the code to detect the problem. I'll submit a documentation change patch.

There is also a problem that TEST_NAME does not work in some situations. I will open another ticket for that.

comment:4 Changed 6 months ago by Tim Graham <timograham@…>

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

In 9700194195735300f86803b0d023a37a89f4dff0:

Fixed #21222 - Documented that 'default' and 'other' must be different databases when running tests.

Thanks vernondcole for the suggestion.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.