Unable to run unit tests when using PostGIS database backend

Bug #1004180 reported by Dave Pifke
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-django (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

LP: #905837 described an incompatibility between Django and the latest version of psycopg2. The fix for that issue was applied in 1.3.1-4ubuntu1. The problem is that the fix as applied does not solve the issue if using the PostGIS database backend. An additional one-line fix (patch attached) is needed.

The symptom of this problem is that applications built using PostGIS are unable to run any unit tests. The error shown is:

  Got an error creating the test database: CREATE DATABASE cannot run inside a transaction block

The fix involves changing the class inheritance of django.contrib.gis.db.backends.postgis.creation.DatabaseCreation to subclass the patched class from django.db.backends.postgresql_psycopg2 rather than django.db.backends.postgresql.

Django 1.4 removes django.db.backends.postgresql and renames postgresql_psycopg2 to just postgresql, thus this fix is not needed for newer versions.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: python-django 1.3.1-4ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-24.38-virtual 3.2.16
Uname: Linux 3.2.0-24-virtual x86_64
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Thu May 24 20:54:11 2012
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: python-django
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dave Pifke (dave-thingomatic) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "One-line patch to make PostGIS compatible with psycopg2 > 2.4.1" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-django (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.