Fixed #21187 -- Import CursorWrapper from django.db.backend.utils

The import was done from util instead of utils leading to
PendingDeprecationWarning.
This commit is contained in:
Anssi Kääriäinen 2013-09-28 14:06:40 +03:00
parent 1a63092981
commit 47e79bfcfb
1 changed files with 1 additions and 3 deletions

View File

@ -15,7 +15,7 @@ from django.db import (connection, connections, DEFAULT_DB_ALIAS,
from django.db.backends.signals import connection_created from django.db.backends.signals import connection_created
from django.db.backends.sqlite3.base import DatabaseOperations from django.db.backends.sqlite3.base import DatabaseOperations
from django.db.backends.postgresql_psycopg2 import version as pg_version from django.db.backends.postgresql_psycopg2 import version as pg_version
from django.db.backends.utils import format_number from django.db.backends.utils import format_number, CursorWrapper
from django.db.models import Sum, Avg, Variance, StdDev from django.db.models import Sum, Avg, Variance, StdDev
from django.db.models.fields import (AutoField, DateField, DateTimeField, from django.db.models.fields import (AutoField, DateField, DateTimeField,
DecimalField, IntegerField, TimeField) DecimalField, IntegerField, TimeField)
@ -618,7 +618,6 @@ class BackendTestCase(TestCase):
Test that cursors can be used as a context manager Test that cursors can be used as a context manager
""" """
with connection.cursor() as cursor: with connection.cursor() as cursor:
from django.db.backends.util import CursorWrapper
self.assertTrue(isinstance(cursor, CursorWrapper)) self.assertTrue(isinstance(cursor, CursorWrapper))
# Both InterfaceError and ProgrammingError seem to be used when # Both InterfaceError and ProgrammingError seem to be used when
# accessing closed cursor (psycopg2 has InterfaceError, rest seem # accessing closed cursor (psycopg2 has InterfaceError, rest seem
@ -634,7 +633,6 @@ class BackendTestCase(TestCase):
# psycopg2 offers us a way to check that by closed attribute. # psycopg2 offers us a way to check that by closed attribute.
# So, run only on psycopg2 for that reason. # So, run only on psycopg2 for that reason.
with connection.cursor() as cursor: with connection.cursor() as cursor:
from django.db.backends.util import CursorWrapper
self.assertTrue(isinstance(cursor, CursorWrapper)) self.assertTrue(isinstance(cursor, CursorWrapper))
self.assertTrue(cursor.closed) self.assertTrue(cursor.closed)