Opened 13 years ago

Closed 13 years ago

Last modified 13 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 "manage.py", line 11, in <module>
    execute_manager(settings) 
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.p
y", line 438, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/test.py", line 37, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/local/lib/python2.6/dist-packages/django/test/simple.py", line 361, in run_tests
    self.teardown_databases(old_config)
  File "/usr/local/lib/python2.6/dist-packages/django/test/simple.py", 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/creation.py", 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/creation.py", line 461, in _destroy_test_db
    self.set_autocommit()
  File "/usr/local/lib/python2.6/dist-packages/django/db/backends/creation.py", line 472, in set_autocommit
    self.connection.connection.autocommit = True
psycopg2.ProgrammingError: autocommit cannot be used inside a transaction

Change History (2)

comment:1 by Aymeric Augustin, 13 years ago

Description: modified (diff)
Resolution: needsinfo
Status: newclosed

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

NB: edited description to fix formatting.

comment:2 by Ramiro Morales, 13 years ago

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