1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

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

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.sqlite3.base import DatabaseOperations
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.fields import (AutoField, DateField, DateTimeField,
DecimalField, IntegerField, TimeField)
@ -618,7 +618,6 @@ class BackendTestCase(TestCase):
Test that cursors can be used as a context manager
"""
with connection.cursor() as cursor:
from django.db.backends.util import CursorWrapper
self.assertTrue(isinstance(cursor, CursorWrapper))
# Both InterfaceError and ProgrammingError seem to be used when
# 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.
# So, run only on psycopg2 for that reason.
with connection.cursor() as cursor:
from django.db.backends.util import CursorWrapper
self.assertTrue(isinstance(cursor, CursorWrapper))
self.assertTrue(cursor.closed)