Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#16466 closed Bug (needsinfo)

Similar to ticket 16250, _destroy_test_db calls self.set_autocommit()

Reported by: ryazwinski Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Aymeric Augustin)

Destroying test database for alias 'default'...
Traceback (most recent call last):
  File "", line 11, in <module>
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.p
y", line 438, in execute_manager
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/", line 379, in execute
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/", line 37, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/local/lib/python2.6/dist-packages/django/test/", line 361, in run_tests
  File "/usr/local/lib/python2.6/dist-packages/django/test/", line 327, in teardown_databases
    connection.creation.destroy_test_db(old_name, self.verbosity)
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/", line 452, in destroy_test_db
    self._destroy_test_db(test_database_name, verbosity)
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/", line 461, in _destroy_test_db
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/", line 472, in set_autocommit
    self.connection.connection.autocommit = True
psycopg2.ProgrammingError: autocommit cannot be used inside a transaction

Change History (2)

comment:1 Changed 5 years ago by Aymeric Augustin

Description: modified (diff)
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: needsinfo
Status: newclosed

How is this different from #16250? Doesn't r16520 fix the issue?

NB: edited description to fix formatting.

comment:2 Changed 5 years ago by Ramiro Morales

I suspect the OP is using Django 1.3 released on March (or the Django 1.3.X branch) and got psycopg2 2.4.2 (released) on June installed.

We fixed compatibility with the changes introduced in psycopg2 2.4.2 ony in trunk for what will become Django 1.4.
Is it is usual with open source projects with a release policy, we don't introduce changes to add compatibility with other software released after our releases, not even in the 1.3.X bug-fix only branch.

Possible solution for the OP would be to

  • Keep using 1.3 (or 1.3.X) and use psycopg2 <= 2.4.1
  • Keep pyscopg2 2.4.2 and switch django to in-development Django trunk
Note: See TracTickets for help on using tickets.
Back to Top