1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Stopped using django.utils.unittest in the test suite.

Refs #20680.
This commit is contained in:
Aymeric Augustin 2013-07-01 14:22:27 +02:00
parent 7f264e02f4
commit cfcf4b3605
123 changed files with 212 additions and 161 deletions

View File

@ -1,8 +1,8 @@
import os import os
from unittest import SkipTest
from django.test import LiveServerTestCase from django.test import LiveServerTestCase
from django.utils.module_loading import import_by_path from django.utils.module_loading import import_by_path
from django.utils.unittest import SkipTest
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _

View File

@ -1,9 +1,10 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import unittest
from django.contrib.admindocs import views from django.contrib.admindocs import views
from django.db import models from django.db import models
from django.db.models import fields from django.db.models import fields
from django.utils import unittest
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _

View File

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest
from unittest import skipUnless
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher, from django.contrib.auth.hashers import (is_password_usable, BasePasswordHasher,
check_password, make_password, PBKDF2PasswordHasher, load_hashers, PBKDF2SHA1PasswordHasher, check_password, make_password, PBKDF2PasswordHasher, load_hashers, PBKDF2SHA1PasswordHasher,
get_hasher, identify_hasher, UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH) get_hasher, identify_hasher, UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH)
from django.utils import six from django.utils import six
from django.utils import unittest
from django.utils.unittest import skipUnless
try: try:

View File

@ -1,12 +1,12 @@
import sys
from datetime import date, timedelta from datetime import date, timedelta
import sys
import unittest
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.tests.utils import skipIfCustomUser from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase from django.test import TestCase
from django.utils import unittest
@skipIfCustomUser @skipIfCustomUser

View File

@ -1,5 +1,6 @@
from unittest import skipIf
from django.conf import settings from django.conf import settings
from django.utils.unittest import skipIf
def skipIfCustomUser(test_func): def skipIfCustomUser(test_func):

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import datetime import datetime
import os import os
import unittest
import warnings import warnings
from django import http from django import http
@ -10,7 +11,6 @@ from django.contrib.formtools import preview, utils
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils._os import upath from django.utils._os import upath
from django.utils import unittest
from django.contrib.formtools.tests.forms import * from django.contrib.formtools.tests.forms import *

View File

@ -1,6 +1,7 @@
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.utils import unittest
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import Driver, OGRException from django.contrib.gis.gdal import Driver, OGRException

View File

@ -1,9 +1,9 @@
import os import os
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import get_ds_file, TestDS, TEST_DATA from django.contrib.gis.geometry.test_data import get_ds_file, TestDS, TEST_DATA
from django.utils import unittest
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError, GDAL_VERSION from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError, GDAL_VERSION

View File

@ -1,6 +1,7 @@
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.utils import unittest
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import Envelope, OGRException from django.contrib.gis.gdal import Envelope, OGRException
@ -17,7 +18,7 @@ class EnvelopeTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.e = Envelope(0, 0, 5, 5) self.e = Envelope(0, 0, 5, 5)
def test01_init(self): def test01_init(self):
"Testing Envelope initilization." "Testing Envelope initilization."
e1 = Envelope((0, 0, 5, 5)) e1 = Envelope((0, 0, 5, 5))

View File

@ -4,12 +4,12 @@ try:
from django.utils.six.moves import cPickle as pickle from django.utils.six.moves import cPickle as pickle
except ImportError: except ImportError:
import pickle import pickle
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TestDataMixin from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.six.moves import xrange from django.utils.six.moves import xrange
from django.utils import unittest
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType, from django.contrib.gis.gdal import (OGRGeometry, OGRGeomType,

View File

@ -1,6 +1,7 @@
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.utils import unittest
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import SpatialReference, CoordTransform, OGRException, SRSException from django.contrib.gis.gdal import SpatialReference, CoordTransform, OGRException, SRSException

View File

@ -2,11 +2,12 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
import unittest
from unittest import skipUnless
from django.conf import settings from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geoip import HAS_GEOIP
from django.utils import unittest
from django.utils.unittest import skipUnless
from django.utils import six from django.utils import six

View File

@ -3,6 +3,8 @@ from __future__ import unicode_literals
import ctypes import ctypes
import json import json
import random import random
import unittest
from unittest import skipUnless
from binascii import a2b_hex, b2a_hex from binascii import a2b_hex, b2a_hex
from io import BytesIO from io import BytesIO
@ -14,8 +16,6 @@ from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils import six from django.utils import six
from django.utils.six.moves import xrange from django.utils.six.moves import xrange
from django.utils import unittest
from django.utils.unittest import skipUnless
from .. import HAS_GEOS from .. import HAS_GEOS

View File

@ -2,8 +2,8 @@
# Modified from original contribution by Aryeh Leib Taurog, which was # Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license. # released under the New BSD license.
from django.utils import unittest import unittest
from django.utils.unittest import skipUnless from unittest import skipUnless
from .. import HAS_GEOS from .. import HAS_GEOS

View File

@ -2,9 +2,9 @@ from __future__ import unicode_literals
import binascii import binascii
import unittest import unittest
from unittest import skipUnless
from django.contrib.gis import memoryview from django.contrib.gis import memoryview
from django.utils.unittest import skipUnless
from ..import HAS_GEOS from ..import HAS_GEOS

View File

@ -3,9 +3,11 @@
# #
# Modified from original contribution by Aryeh Leib Taurog, which was # Modified from original contribution by Aryeh Leib Taurog, which was
# released under the New BSD license. # released under the New BSD license.
import unittest
from django.contrib.gis.geos.mutable_list import ListMixin from django.contrib.gis.geos.mutable_list import ListMixin
from django.utils import six from django.utils import six
from django.utils import unittest
class UserListA(ListMixin): class UserListA(ListMixin):

View File

@ -1,5 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from unittest import skipUnless
from django.db import connection from django.db import connection
from django.db.models import Q from django.db.models import Q
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
@ -8,7 +10,6 @@ from django.contrib.gis.tests.utils import (
HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite
) )
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
if HAS_GEOS and HAS_SPATIAL_DB: if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis.geos import GEOSGeometry, LineString from django.contrib.gis.geos import GEOSGeometry, LineString

View File

@ -2,13 +2,13 @@ from __future__ import absolute_import, unicode_literals
import os import os
import re import re
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import postgis from django.contrib.gis.tests.utils import postgis
from django.test import TestCase from django.test import TestCase
from django.utils._os import upath from django.utils._os import upath
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from django.contrib.gis.db.models import Union, Extent3D from django.contrib.gis.db.models import Union, Extent3D

View File

@ -1,9 +1,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from unittest import skipUnless
from django.test import TestCase from django.test import TestCase
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.utils.unittest import skipUnless
if HAS_GEOS and HAS_SPATIAL_DB: if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis import admin from django.contrib.gis import admin

View File

@ -1,5 +1,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from unittest import skipUnless
from xml.dom import minidom from xml.dom import minidom
from django.conf import settings from django.conf import settings
@ -7,7 +8,6 @@ from django.contrib.sites.models import Site
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from .models import City from .models import City

View File

@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import datetime from datetime import datetime
from unittest import skipUnless
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import no_mysql, no_spatialite from django.contrib.gis.tests.utils import no_mysql, no_spatialite
@ -9,7 +10,6 @@ from django.contrib.gis.shortcuts import render_to_kmz
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.db.models import Count, Min from django.db.models import Count, Min
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from .models import City, PennsylvaniaCity, State, Truth from .models import City, PennsylvaniaCity, State, Truth

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from io import BytesIO from io import BytesIO
from unittest import skipUnless
from xml.dom import minidom from xml.dom import minidom
import zipfile import zipfile
@ -9,7 +10,6 @@ from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from .models import City, Country from .models import City, Country

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import re import re
from unittest import skipUnless
from django.db import connection from django.db import connection
from django.contrib.gis import gdal from django.contrib.gis import gdal
@ -10,7 +11,6 @@ from django.contrib.gis.tests.utils import (
mysql, oracle, postgis, spatialite) mysql, oracle, postgis, spatialite)
from django.test import TestCase from django.test import TestCase
from django.utils import six, unittest from django.utils import six, unittest
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from django.contrib.gis.geos import (fromstr, GEOSGeometry, from django.contrib.gis.geos import (fromstr, GEOSGeometry,

View File

@ -4,6 +4,7 @@ Tests for geography support in PostGIS 1.5+
from __future__ import absolute_import from __future__ import absolute_import
import os import os
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
@ -11,7 +12,6 @@ from django.contrib.gis.measure import D
from django.contrib.gis.tests.utils import postgis from django.contrib.gis.tests.utils import postgis
from django.test import TestCase from django.test import TestCase
from django.utils._os import upath from django.utils._os import upath
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from .models import City, County, Zipcode from .models import City, County, Zipcode

View File

@ -1,13 +1,13 @@
from __future__ import absolute_import from __future__ import absolute_import
import os import os
from unittest import skipUnless
from django.db import connections from django.db import connections
from django.test import TestCase from django.test import TestCase
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TEST_DATA from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.utils.unittest import skipUnless
if HAS_GDAL: if HAS_GDAL:
from django.contrib.gis.gdal import Driver from django.contrib.gis.gdal import Driver

View File

@ -1,17 +1,17 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import os
from copy import copy from copy import copy
from decimal import Decimal from decimal import Decimal
import os
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql
from django.db import router from django.db import router
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.utils import unittest
from django.utils.unittest import skipUnless
from django.utils._os import upath from django.utils._os import upath
if HAS_GDAL: if HAS_GDAL:

View File

@ -1,9 +1,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from unittest import skipUnless
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite from django.contrib.gis.tests.utils import HAS_SPATIAL_DB, mysql, oracle, no_mysql, no_oracle, no_spatialite
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
if HAS_GEOS: if HAS_GEOS:
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union from django.contrib.gis.db.models import Collect, Count, Extent, F, Union

View File

@ -1,15 +1,16 @@
from unittest import skipUnless
from django.forms import ValidationError from django.forms import ValidationError
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS from django.contrib.gis.tests.utils import HAS_SPATIALREFSYS
from django.test import SimpleTestCase from django.test import SimpleTestCase
from django.utils import six from django.utils import six
from django.utils.unittest import skipUnless
if HAS_SPATIALREFSYS: if HAS_SPATIALREFSYS:
from django.contrib.gis import forms from django.contrib.gis import forms
from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis.geos import GEOSGeometry
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database") @skipUnless(HAS_GDAL and HAS_SPATIALREFSYS, "GeometryFieldTest needs gdal support and a spatial database")
class GeometryFieldTest(SimpleTestCase): class GeometryFieldTest(SimpleTestCase):
@ -143,7 +144,7 @@ class SpecializedFieldTest(SimpleTestCase):
def assertTextarea(self, geom, rendered): def assertTextarea(self, geom, rendered):
"""Makes sure the wkt and a textarea are in the content""" """Makes sure the wkt and a textarea are in the content"""
self.assertIn('<textarea ', rendered) self.assertIn('<textarea ', rendered)
self.assertIn('required', rendered) self.assertIn('required', rendered)
self.assertIn(geom.wkt, rendered) self.assertIn(geom.wkt, rendered)

View File

@ -3,8 +3,9 @@ Distance and Area objects to allow for sensible and convienient calculation
and conversions. Here are some tests. and conversions. Here are some tests.
""" """
import unittest
from django.contrib.gis.measure import Distance, Area, D, A from django.contrib.gis.measure import Distance, Area, D, A
from django.utils import unittest
class DistanceTest(unittest.TestCase): class DistanceTest(unittest.TestCase):

View File

@ -1,8 +1,9 @@
import unittest
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis, from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis,
spatialite, HAS_SPATIALREFSYS, SpatialRefSys) spatialite, HAS_SPATIALREFSYS, SpatialRefSys)
from django.utils import six from django.utils import six
from django.utils import unittest
test_srs = ({'srid' : 4326, test_srs = ({'srid' : 4326,

View File

@ -1,6 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import datetime import datetime
from decimal import Decimal from decimal import Decimal
from unittest import skipIf
try: try:
import pytz import pytz
@ -17,7 +18,6 @@ from django.utils.timezone import utc
from django.utils import translation from django.utils import translation
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils import tzinfo from django.utils import tzinfo
from django.utils.unittest import skipIf
from i18n import TransRealMixin from i18n import TransRealMixin

View File

@ -1,3 +1,5 @@
from unittest import skipIf
from django import http from django import http
from django.conf import settings, global_settings from django.conf import settings, global_settings
from django.contrib.messages import constants, utils, get_level, set_level from django.contrib.messages import constants, utils, get_level, set_level
@ -7,7 +9,6 @@ from django.contrib.messages.storage.base import Message
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy from django.utils.translation import ugettext_lazy
from django.utils.unittest import skipIf
def skipUnlessAuthIsInstalled(func): def skipUnlessAuthIsInstalled(func):

View File

@ -1,6 +1,7 @@
import unittest
from django import http from django import http
from django.contrib.messages.middleware import MessageMiddleware from django.contrib.messages.middleware import MessageMiddleware
from django.utils import unittest
class MiddlewareTest(unittest.TestCase): class MiddlewareTest(unittest.TestCase):

View File

@ -4,6 +4,7 @@ import os
import shutil import shutil
import string import string
import tempfile import tempfile
import unittest
import warnings import warnings
from django.conf import settings from django.conf import settings
@ -22,7 +23,6 @@ from django.test import TestCase, RequestFactory
from django.test.utils import override_settings, patch_logger from django.test.utils import override_settings, patch_logger
from django.utils import six from django.utils import six
from django.utils import timezone from django.utils import timezone
from django.utils import unittest
from django.contrib.sessions.exceptions import InvalidSessionKey from django.contrib.sessions.exceptions import InvalidSessionKey

View File

@ -1,7 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import skipUnless
from django.conf import settings from django.conf import settings
from django.utils.unittest import skipUnless
from .base import SitemapTestsBase from .base import SitemapTestsBase

View File

@ -2,13 +2,13 @@ from __future__ import unicode_literals
import os import os
from datetime import date from datetime import date
from unittest import skipUnless
from django.conf import settings from django.conf import settings
from django.contrib.sitemaps import Sitemap, GenericSitemap from django.contrib.sitemaps import Sitemap, GenericSitemap
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.unittest import skipUnless
from django.utils.formats import localize from django.utils.formats import localize
from django.utils._os import upath from django.utils._os import upath
from django.utils.translation import activate, deactivate from django.utils.translation import activate, deactivate

View File

@ -1,12 +1,12 @@
import os import os
from optparse import make_option from optparse import make_option
import unittest
from unittest import TestSuite, defaultTestLoader
from django.conf import settings from django.conf import settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from django.test.utils import setup_test_environment, teardown_test_environment from django.test.utils import setup_test_environment, teardown_test_environment
from django.utils import unittest
from django.utils.unittest import TestSuite, defaultTestLoader
class DiscoverRunner(object): class DiscoverRunner(object):

View File

@ -8,13 +8,16 @@ import json
import os import os
import re import re
import sys import sys
import select
import socket
import threading
import unittest
from unittest import skipIf # Imported here for backward compatibility
from unittest.util import safe_repr
try: try:
from urllib.parse import urlsplit, urlunsplit from urllib.parse import urlsplit, urlunsplit
except ImportError: # Python 2 except ImportError: # Python 2
from urlparse import urlsplit, urlunsplit from urlparse import urlsplit, urlunsplit
import select
import socket
import threading
from django.conf import settings from django.conf import settings
from django.contrib.staticfiles.handlers import StaticFilesHandler from django.contrib.staticfiles.handlers import StaticFilesHandler
@ -36,10 +39,8 @@ from django.test.html import HTMLParseError, parse_html
from django.test.signals import template_rendered from django.test.signals import template_rendered
from django.test.utils import (CaptureQueriesContext, ContextList, from django.test.utils import (CaptureQueriesContext, ContextList,
override_settings, compare_xml) override_settings, compare_xml)
from django.utils import six, unittest as ut2 from django.utils import six
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.unittest import skipIf # Imported here for backward compatibility
from django.utils.unittest.util import safe_repr
from django.views.static import serve from django.views.static import serve
@ -155,7 +156,7 @@ class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext):
return '%s was rendered.' % self.template_name return '%s was rendered.' % self.template_name
class SimpleTestCase(ut2.TestCase): class SimpleTestCase(unittest.TestCase):
# The class we'll use for the test client self.client. # The class we'll use for the test client self.client.
# Can be overridden in derived classes. # Can be overridden in derived classes.
@ -886,7 +887,7 @@ def _deferredSkip(condition, reason):
@wraps(test_func) @wraps(test_func)
def skip_wrapper(*args, **kwargs): def skip_wrapper(*args, **kwargs):
if condition(): if condition():
raise ut2.SkipTest(reason) raise unittest.SkipTest(reason)
return test_func(*args, **kwargs) return test_func(*args, **kwargs)
test_item = skip_wrapper test_item = skip_wrapper
else: else:

View File

@ -37,7 +37,7 @@ Example
The following is a simple unit test using the request factory:: The following is a simple unit test using the request factory::
from django.utils import unittest import unittest
from django.test.client import RequestFactory from django.test.client import RequestFactory
class SimpleTest(unittest.TestCase): class SimpleTest(unittest.TestCase):

View File

@ -800,7 +800,7 @@ Example
The following is a simple unit test using the test client:: The following is a simple unit test using the test client::
from django.utils import unittest import unittest
from django.test.client import Client from django.test.client import Client
class SimpleTest(unittest.TestCase): class SimpleTest(unittest.TestCase):
@ -1143,7 +1143,7 @@ worry about state (such as cookies) carrying over from one test to another.
This means, instead of instantiating a ``Client`` in each test:: This means, instead of instantiating a ``Client`` in each test::
from django.utils import unittest import unittest
from django.test.client import Client from django.test.client import Client
class SimpleTest(unittest.TestCase): class SimpleTest(unittest.TestCase):

View File

@ -6,13 +6,14 @@ and default settings.py files.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
import codecs
import os import os
import re import re
import shutil import shutil
import socket import socket
import subprocess import subprocess
import sys import sys
import codecs import unittest
import django import django
from django import conf, get_version from django import conf, get_version
@ -20,7 +21,6 @@ from django.conf import settings
from django.core.management import BaseCommand, CommandError from django.core.management import BaseCommand, CommandError
from django.db import connection from django.db import connection
from django.test.runner import DiscoverRunner from django.test.runner import DiscoverRunner
from django.utils import unittest
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils._os import upath from django.utils._os import upath
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -2,6 +2,7 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import datetime from datetime import datetime
from unittest import TestCase
from django import forms from django import forms
from django.conf import settings from django.conf import settings
@ -16,7 +17,6 @@ from django.test.utils import override_settings
from django.utils import six from django.utils import six
from django.utils import translation from django.utils import translation
from django.utils.html import conditional_escape from django.utils.html import conditional_escape
from django.utils.unittest import TestCase
from . import models from . import models
from .widgetadmin import site as widget_admin_site from .widgetadmin import site as widget_admin_site

View File

@ -10,7 +10,6 @@ from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q
from django.test import TestCase, Approximate, skipUnlessDBFeature from django.test import TestCase, Approximate, skipUnlessDBFeature
from django.utils import six from django.utils import six
from django.utils.unittest import expectedFailure
from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook, from .models import (Author, Book, Publisher, Clues, Entries, HardbackBook,
ItemTag, WithManualPK) ItemTag, WithManualPK)

View File

@ -4,11 +4,12 @@ import copy
import os import os
import sys import sys
import time import time
from unittest import TestCase
from django.conf import Settings from django.conf import Settings
from django.db.models.loading import cache, load_app, get_model, get_models from django.db.models.loading import cache, load_app, get_model, get_models
from django.utils._os import upath from django.utils._os import upath
from django.utils.unittest import TestCase
class EggLoadingTest(TestCase): class EggLoadingTest(TestCase):

View File

@ -3,10 +3,10 @@ A series of tests to establish that the command-line bash completion works.
""" """
import os import os
import sys import sys
import unittest
from django.conf import settings from django.conf import settings
from django.core.management import ManagementUtility from django.core.management import ManagementUtility
from django.utils import unittest
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -8,9 +8,9 @@ from __future__ import absolute_import
import os import os
import shutil import shutil
import unittest
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
from django.utils import unittest
from django.utils._os import upath from django.utils._os import upath
from .models import Photo, PhotoForm, temp_storage_dir from .models import Photo, PhotoForm, temp_storage_dir

View File

@ -1,5 +1,6 @@
from unittest import TestCase
from django.contrib import admin from django.contrib import admin
from django.utils.unittest import TestCase
class Bug8245Test(TestCase): class Bug8245Test(TestCase):

View File

@ -1,9 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from io import BytesIO from io import BytesIO
from unittest import TestCase
from django.core.servers.basehttp import ServerHandler, MAX_SOCKET_CHUNK_SIZE from django.core.servers.basehttp import ServerHandler, MAX_SOCKET_CHUNK_SIZE
from django.utils.unittest import TestCase
class DummyHandler(object): class DummyHandler(object):

View File

@ -1,10 +1,10 @@
# Unit tests for typecast functions in django.db.backends.util # Unit tests for typecast functions in django.db.backends.util
import datetime import datetime
import unittest
from django.db.backends import util as typecasts from django.db.backends import util as typecasts
from django.utils import six from django.utils import six
from django.utils import unittest
TEST_CASES = { TEST_CASES = {

View File

@ -1,4 +1,5 @@
from functools import wraps from functools import wraps
from unittest import TestCase
from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
@ -6,7 +7,6 @@ from django.http import HttpResponse, HttpRequest, HttpResponseNotAllowed
from django.middleware.clickjacking import XFrameOptionsMiddleware from django.middleware.clickjacking import XFrameOptionsMiddleware
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.functional import allow_lazy, lazy, memoize from django.utils.functional import allow_lazy, lazy, memoize
from django.utils.unittest import TestCase
from django.views.decorators.cache import cache_page, never_cache, cache_control from django.views.decorators.cache import cache_page, never_cache, cache_control
from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt from django.views.decorators.clickjacking import xframe_options_deny, xframe_options_sameorigin, xframe_options_exempt
from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition from django.views.decorators.http import require_http_methods, require_GET, require_POST, require_safe, condition

View File

@ -3,11 +3,12 @@ from __future__ import unicode_literals
import datetime import datetime
import decimal import decimal
import unittest
from django.template.defaultfilters import * from django.template.defaultfilters import *
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
from django.utils import unittest, translation from django.utils import translation
from django.utils.safestring import SafeData from django.utils.safestring import SafeData
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible

View File

@ -1,9 +1,9 @@
import gc import gc
import sys import sys
import time import time
import unittest
from django.dispatch import Signal, receiver from django.dispatch import Signal, receiver
from django.utils import unittest
if sys.platform.startswith('java'): if sys.platform.startswith('java'):

View File

@ -1,6 +1,7 @@
import unittest
from django.dispatch.saferef import safeRef from django.dispatch.saferef import safeRef
from django.utils.six.moves import xrange from django.utils.six.moves import xrange
from django.utils import unittest
class Test1(object): class Test1(object):
def x(self): def x(self):

View File

@ -7,6 +7,7 @@ import shutil
import sys import sys
import tempfile import tempfile
import time import time
import unittest
try: try:
from urllib.request import urlopen from urllib.request import urlopen
except ImportError: # Python 2 except ImportError: # Python 2
@ -28,7 +29,6 @@ from django.core.files.storage import FileSystemStorage, get_storage_class
from django.core.files.uploadedfile import UploadedFile from django.core.files.uploadedfile import UploadedFile
from django.test import LiveServerTestCase, SimpleTestCase from django.test import LiveServerTestCase, SimpleTestCase
from django.utils import six from django.utils import six
from django.utils import unittest
from django.utils._os import upath from django.utils._os import upath
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -8,6 +8,7 @@ import json
import os import os
import shutil import shutil
import tempfile as sys_tempfile import tempfile as sys_tempfile
import unittest
from django.core.files import temp as tempfile from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
@ -16,7 +17,6 @@ from django.test import TestCase, client
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.six import StringIO from django.utils.six import StringIO
from django.utils import unittest
from . import uploadhandler from . import uploadhandler
from .models import FileModel from .models import FileModel

View File

@ -4,6 +4,7 @@ import os
import gzip import gzip
import shutil import shutil
import tempfile import tempfile
import unittest
from django.core.cache import cache from django.core.cache import cache
from django.core.files import File from django.core.files import File
@ -11,7 +12,6 @@ from django.core.files.move import file_move_safe
from django.core.files.base import ContentFile from django.core.files.base import ContentFile
from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase from django.test import TestCase
from django.utils import unittest
from django.utils.six import StringIO from django.utils.six import StringIO
from .models import Storage, temp_storage, temp_storage_location from .models import Storage, temp_storage, temp_storage_location

View File

@ -1,9 +1,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import TestCase
from django import forms from django import forms
from django.core import validators from django.core import validators
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.unittest import TestCase
class UserForm(forms.Form): class UserForm(forms.Form):

View File

@ -1,11 +1,11 @@
from __future__ import absolute_import from __future__ import absolute_import
import time import time
import unittest
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory
from django.utils import unittest
from django.views.generic import View, TemplateView, RedirectView from django.views.generic import View, TemplateView, RedirectView
from . import views from . import views

View File

@ -2,12 +2,12 @@ from __future__ import absolute_import
import time import time
import datetime import datetime
from unittest import skipUnless
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import timezone from django.utils import timezone
from django.utils.unittest import skipUnless
from .models import Book, BookSigning from .models import Book, BookSigning

View File

@ -1,12 +1,12 @@
from __future__ import absolute_import from __future__ import absolute_import
import warnings import warnings
from unittest import expectedFailure
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django import forms from django import forms
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import expectedFailure
from django.test.client import RequestFactory from django.test.client import RequestFactory
from django.views.generic.base import View from django.views.generic.base import View
from django.views.generic.edit import FormMixin, CreateView from django.views.generic.edit import FormMixin, CreateView

View File

@ -4,6 +4,7 @@ from __future__ import unicode_literals
import copy import copy
import os import os
import pickle import pickle
import unittest
import warnings import warnings
from django.core.exceptions import SuspiciousOperation from django.core.exceptions import SuspiciousOperation
@ -18,7 +19,6 @@ from django.test import TestCase
from django.utils.encoding import smart_str from django.utils.encoding import smart_str
from django.utils._os import upath from django.utils._os import upath
from django.utils import six from django.utils import six
from django.utils import unittest
class QueryDictTests(unittest.TestCase): class QueryDictTests(unittest.TestCase):

View File

@ -1,7 +1,8 @@
from unittest import skipUnless
from django.core.management.color import no_style from django.core.management.color import no_style
from django.db import connections, DEFAULT_DB_ALIAS from django.db import connections, DEFAULT_DB_ALIAS
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import skipUnless
from .models import Article from .models import Article

View File

@ -2,11 +2,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
from unittest import expectedFailure
from django.core.management import call_command from django.core.management import call_command
from django.db import connection from django.db import connection
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from django.utils.unittest import expectedFailure
from django.utils.six import PY3, StringIO from django.utils.six import PY3, StringIO
if connection.vendor == 'oracle': if connection.vendor == 'oracle':

View File

@ -1,8 +1,9 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import unittest
from django.db import connection from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
from django.utils import unittest
from .models import Reporter, Article from .models import Reporter, Article

View File

@ -1,11 +1,10 @@
import copy import copy
import sys import sys
import unittest
from django.core.management.validation import get_validation_errors from django.core.management.validation import get_validation_errors
from django.db.models.loading import cache, load_app from django.db.models.loading import cache, load_app
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import unittest
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import copy import copy
import logging import logging
import sys import sys
from unittest import skipUnless
import warnings import warnings
from django.conf import LazySettings from django.conf import LazySettings
@ -13,7 +14,6 @@ from django.utils.encoding import force_text
from django.utils.log import (CallbackFilter, RequireDebugFalse, from django.utils.log import (CallbackFilter, RequireDebugFalse,
RequireDebugTrue) RequireDebugTrue)
from django.utils.six import StringIO from django.utils.six import StringIO
from django.utils.unittest import skipUnless
from admin_scripts.tests import AdminScriptTestCase from admin_scripts.tests import AdminScriptTestCase

View File

@ -1,6 +1,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from django.utils import unittest import unittest
from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
@ -36,4 +36,4 @@ class MaxLengthORMTests(unittest.TestCase):
new_args = args.copy() new_args = args.copy()
new_args[field] = "X" * 250 # a value longer than any of the default fields could hold. new_args[field] = "X" * 250 # a value longer than any of the default fields could hold.
p = PersonWithCustomMaxLengths.objects.create(**new_args) p = PersonWithCustomMaxLengths.objects.create(**new_args)
self.assertEqual(getattr(p, field), ("X" * 250)) self.assertEqual(getattr(p, field), ("X" * 250))

View File

@ -5,6 +5,7 @@ import gzip
from io import BytesIO from io import BytesIO
import random import random
import re import re
from unittest import expectedFailure, skipIf
import warnings import warnings
from django.conf import settings from django.conf import settings
@ -22,7 +23,6 @@ from django.test.utils import override_settings, IgnoreDeprecationWarningsMixin
from django.utils import six from django.utils import six
from django.utils.encoding import force_str from django.utils.encoding import force_str
from django.utils.six.moves import xrange from django.utils.six.moves import xrange
from django.utils.unittest import expectedFailure, skipIf
from .models import Band from .models import Band

View File

@ -2,13 +2,13 @@ from __future__ import absolute_import
import os import os
import shutil import shutil
from unittest import skipIf
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.files import File from django.core.files import File
from django.core.files.images import ImageFile from django.core.files.images import ImageFile
from django.test import TestCase from django.test import TestCase
from django.utils._os import upath from django.utils._os import upath
from django.utils.unittest import skipIf
try: try:
from .models import Image from .models import Image

View File

@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
import datetime import datetime
from decimal import Decimal from decimal import Decimal
import unittest
from django import test from django import test
from django import forms from django import forms
@ -9,7 +10,6 @@ from django.core.exceptions import ValidationError
from django.db import connection, models, IntegrityError from django.db import connection, models, IntegrityError
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from django.utils import six from django.utils import six
from django.utils import unittest
from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post, from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
NullBooleanModel, BooleanModel, DataModel, Document, RenamedField, NullBooleanModel, BooleanModel, DataModel, Document, RenamedField,

View File

@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
import datetime import datetime
import os import os
from decimal import Decimal from decimal import Decimal
from unittest import skipUnless
import warnings import warnings
from django import forms from django import forms
@ -13,7 +14,6 @@ from django.db import connection
from django.db.models.query import EmptyQuerySet from django.db.models.query import EmptyQuerySet
from django.forms.models import model_to_dict from django.forms.models import model_to_dict
from django.utils._os import upath from django.utils._os import upath
from django.utils.unittest import skipUnless
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import date from datetime import date
import unittest
import warnings import warnings
from django import forms from django import forms
@ -9,7 +10,6 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms.models import (modelform_factory, ModelChoiceField, from django.forms.models import (modelform_factory, ModelChoiceField,
fields_for_model, construct_instance, ModelFormMetaclass) fields_for_model, construct_instance, ModelFormMetaclass)
from django.utils import six from django.utils import six
from django.utils import unittest
from django.test import TestCase from django.test import TestCase
from .models import (Person, RealPerson, Triple, FilePathModel, Article, from .models import (Person, RealPerson, Triple, FilePathModel, Article,

View File

@ -5,10 +5,10 @@ from __future__ import absolute_import, unicode_literals
import datetime import datetime
from operator import attrgetter from operator import attrgetter
from django import forms from unittest import expectedFailure
from django import forms
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import expectedFailure
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot, from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent, ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,

View File

@ -3,12 +3,12 @@ from __future__ import absolute_import, unicode_literals
import datetime import datetime
from operator import attrgetter from operator import attrgetter
import sys import sys
import unittest
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from django.utils import six from django.utils import six
from django.utils import tzinfo from django.utils import tzinfo
from django.utils import unittest
from django.db import connection, router from django.db import connection, router
from django.db.models.sql import InsertQuery from django.db.models.sql import InsertQuery

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import date from datetime import date
import unittest
from django import forms from django import forms
from django.conf import settings from django.conf import settings
@ -15,7 +16,7 @@ from django.forms.models import BaseModelFormSet
from django.forms.widgets import Select from django.forms.widgets import Select
from django.test import TestCase from django.test import TestCase
from django.test.utils import str_prefix from django.test.utils import str_prefix
from django.utils import unittest, six from django.utils import six
from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel

View File

@ -1,12 +1,12 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from datetime import datetime from datetime import datetime
import unittest
from django.core.paginator import (Paginator, EmptyPage, InvalidPage, from django.core.paginator import (Paginator, EmptyPage, InvalidPage,
PageNotAnInteger) PageNotAnInteger)
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
from django.utils import unittest
from .models import Article from .models import Article
from .custom import ValidAdjacentNumsPaginator from .custom import ValidAdjacentNumsPaginator

View File

@ -4,6 +4,7 @@ import datetime
from operator import attrgetter from operator import attrgetter
import pickle import pickle
import sys import sys
import unittest
from django.conf import settings from django.conf import settings
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
@ -13,7 +14,6 @@ from django.db.models.sql.where import WhereNode, EverythingNode, NothingNode
from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.datastructures import EmptyResultSet
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import str_prefix from django.test.utils import str_prefix
from django.utils import unittest
from django.utils.datastructures import SortedDict from django.utils.datastructures import SortedDict
from .models import ( from .models import (

View File

@ -1,10 +1,11 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
import time
import warnings
from datetime import datetime, timedelta from datetime import datetime, timedelta
from io import BytesIO from io import BytesIO
import time
from unittest import skipIf
import warnings
from django.db import connection, connections, DEFAULT_DB_ALIAS from django.db import connection, connections, DEFAULT_DB_ALIAS
from django.core import signals from django.core import signals
@ -15,7 +16,6 @@ from django.test import SimpleTestCase, TransactionTestCase
from django.test.client import FakePayload from django.test.client import FakePayload
from django.test.utils import override_settings, str_prefix from django.test.utils import override_settings, str_prefix
from django.utils import six from django.utils import six
from django.utils.unittest import skipIf
from django.utils.http import cookie_date, urlencode from django.utils.http import cookie_date, urlencode
from django.utils.timezone import utc from django.utils.timezone import utc

View File

@ -1,8 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import TestCase
from django.core.urlresolvers import NoReverseMatch from django.core.urlresolvers import NoReverseMatch
from django.contrib.auth.views import logout from django.contrib.auth.views import logout
from django.utils.unittest import TestCase
from django.shortcuts import resolve_url from django.shortcuts import resolve_url
from .models import UnimportantThing from .models import UnimportantThing

View File

@ -2,13 +2,13 @@ from __future__ import absolute_import
import sys import sys
import time import time
import unittest
from django.conf import settings from django.conf import settings
from django.db import transaction, connection from django.db import transaction, connection
from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError
from django.test import (TransactionTestCase, skipIfDBFeature, from django.test import (TransactionTestCase, skipIfDBFeature,
skipUnlessDBFeature) skipUnlessDBFeature)
from django.utils import unittest
from .models import Person from .models import Person

View File

@ -1,7 +1,8 @@
from __future__ import absolute_import from __future__ import absolute_import
import unittest
from django.test import TestCase from django.test import TestCase
from django.utils import unittest
from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails, from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
AdvancedUserStat, Image, Product, Parent1, Parent2, Child1, Child2, Child3, AdvancedUserStat, Image, Product, Parent1, Parent2, Child1, Child2, Child3,

View File

@ -3,6 +3,7 @@ from __future__ import absolute_import, unicode_literals
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import json import json
from datetime import datetime from datetime import datetime
import unittest
from xml.dom import minidom from xml.dom import minidom
from django.conf import settings from django.conf import settings
@ -11,7 +12,6 @@ from django.db import transaction, connection
from django.test import TestCase, TransactionTestCase, Approximate from django.test import TestCase, TransactionTestCase, Approximate
from django.utils import six from django.utils import six
from django.utils.six import StringIO from django.utils.six import StringIO
from django.utils import unittest
from .models import (Category, Author, Article, AuthorProfile, Actor, Movie, from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
Score, Player, Team) Score, Player, Team)

View File

@ -10,7 +10,7 @@ from __future__ import absolute_import, unicode_literals
import datetime import datetime
import decimal import decimal
from django.core.serializers.xml_serializer import DTDForbidden from unittest import expectedFailure, skipUnless
try: try:
import yaml import yaml
@ -20,13 +20,13 @@ except ImportError:
from django.core import serializers from django.core import serializers
from django.core.serializers import SerializerDoesNotExist from django.core.serializers import SerializerDoesNotExist
from django.core.serializers.base import DeserializationError from django.core.serializers.base import DeserializationError
from django.core.serializers.xml_serializer import DTDForbidden
from django.db import connection, models from django.db import connection, models
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.functional import curry from django.utils.functional import curry
from django.utils.unittest import expectedFailure, skipUnless
from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData, from .models import (BinaryData, BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData, FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,

View File

@ -1,4 +1,5 @@
import os import os
import unittest
import warnings import warnings
from django.conf import settings, global_settings from django.conf import settings, global_settings
@ -6,7 +7,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest from django.http import HttpRequest
from django.test import SimpleTestCase, TransactionTestCase, TestCase, signals from django.test import SimpleTestCase, TransactionTestCase, TestCase, signals
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import unittest, six from django.utils import six
@override_settings(TEST='override', TEST_OUTER='outer') @override_settings(TEST='override', TEST_OUTER='outer')

View File

@ -2,10 +2,10 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import datetime import datetime
from unittest import skipIf
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
from django.utils.unittest import skipIf
from .models import Article, BrokenArticle, InternationalArticle from .models import Article, BrokenArticle, InternationalArticle

View File

@ -9,15 +9,16 @@ from django.conf import settings
if __name__ == '__main__': if __name__ == '__main__':
settings.configure() settings.configure()
import sys
import pkg_resources
import imp import imp
import os.path import os.path
import pkg_resources
import sys
import unittest
from django.template import TemplateDoesNotExist, Context from django.template import TemplateDoesNotExist, Context
from django.template.loaders.eggs import Loader as EggLoader from django.template.loaders.eggs import Loader as EggLoader
from django.template import loader from django.template import loader
from django.utils import unittest, six from django.utils import six
from django.utils._os import upath from django.utils._os import upath
from django.utils.six import StringIO from django.utils.six import StringIO

View File

@ -1,7 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import TestCase
from django import template from django import template
from django.utils.unittest import TestCase
class CallableVariablesTests(TestCase): class CallableVariablesTests(TestCase):

View File

@ -1,6 +1,8 @@
# coding: utf-8 # coding: utf-8
from unittest import TestCase
from django.template import Context from django.template import Context
from django.utils.unittest import TestCase
class ContextTests(TestCase): class ContextTests(TestCase):

View File

@ -1,8 +1,9 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
from unittest import TestCase
from django import template from django import template
from django.utils import six from django.utils import six
from django.utils.unittest import TestCase
from .templatetags import custom from .templatetags import custom

View File

@ -1,6 +1,7 @@
from unittest import TestCase
from django.template import VariableNode, Context from django.template import VariableNode, Context
from django.template.loader import get_template_from_string from django.template.loader import get_template_from_string
from django.utils.unittest import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
class NodelistTest(TestCase): class NodelistTest(TestCase):

View File

@ -3,10 +3,11 @@ Testing some internals of the template processing. These are *not* examples to b
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import TestCase
from django.template import (TokenParser, FilterExpression, Parser, Variable, from django.template import (TokenParser, FilterExpression, Parser, Variable,
Template, TemplateSyntaxError) Template, TemplateSyntaxError)
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils.unittest import TestCase
from django.utils import six from django.utils import six

View File

@ -1,5 +1,6 @@
import unittest
from django.template.smartif import IfParser from django.template.smartif import IfParser
from django.utils import unittest
class SmartIfTests(unittest.TestCase): class SmartIfTests(unittest.TestCase):

View File

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
from unittest import TestCase
from django.template import Template, TemplateEncodingError, Context from django.template import Template, TemplateEncodingError, Context
from django.utils.safestring import SafeData from django.utils.safestring import SafeData
from django.utils import six from django.utils import six
from django.utils.unittest import TestCase
class UnicodeTests(TestCase): class UnicodeTests(TestCase):

View File

@ -13,6 +13,7 @@ import time
import os import os
import sys import sys
import traceback import traceback
import unittest
try: try:
from urllib.parse import urljoin from urllib.parse import urljoin
except ImportError: # Python 2 except ImportError: # Python 2
@ -27,7 +28,6 @@ from django.template.loaders import app_directories, filesystem, cached
from django.test import RequestFactory, TestCase from django.test import RequestFactory, TestCase
from django.test.utils import (setup_test_template_loader, from django.test.utils import (setup_test_template_loader,
restore_template_loaders, override_settings) restore_template_loaders, override_settings)
from django.utils import unittest
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils._os import upath from django.utils._os import upath

View File

@ -1,10 +1,10 @@
from contextlib import contextmanager from contextlib import contextmanager
import os import os
import sys import sys
from unittest import expectedFailure
from django.test import TestCase from django.test import TestCase
from django.test.runner import DiscoverRunner from django.test.runner import DiscoverRunner
from django.utils.unittest import expectedFailure
try: try:
import unittest2 import unittest2

View File

@ -3,8 +3,9 @@ Tests for django test runner
""" """
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import sys
from optparse import make_option from optparse import make_option
import sys
import unittest
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command from django.core.management import call_command
@ -12,7 +13,6 @@ from django import db
from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature
from django.test.testcases import connections_support_transactions from django.test.testcases import connections_support_transactions
from django.test.utils import IgnoreDeprecationWarningsMixin from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import unittest
from django.utils.importlib import import_module from django.utils.importlib import import_module
from admin_scripts.tests import AdminScriptTestCase from admin_scripts.tests import AdminScriptTestCase

View File

@ -1,6 +1,7 @@
import unittest
from django.db.models import get_app from django.db.models import get_app
from django.test.utils import IgnoreDeprecationWarningsMixin from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import unittest
def suite(): def suite():

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import unittest
from unittest import skip
from django.db import connection from django.db import connection
from django.forms import EmailField, IntegerField from django.forms import EmailField, IntegerField
from django.http import HttpResponse from django.http import HttpResponse
@ -9,8 +12,6 @@ from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.html import HTMLParseError, parse_html from django.test.html import HTMLParseError, parse_html
from django.test.utils import CaptureQueriesContext, IgnoreDeprecationWarningsMixin from django.test.utils import CaptureQueriesContext, IgnoreDeprecationWarningsMixin
from django.utils import six from django.utils import six
from django.utils import unittest
from django.utils.unittest import skip
from .models import Person from .models import Person

View File

@ -5,6 +5,7 @@ import os
import re import re
import sys import sys
import time import time
from unittest import skipIf, skipUnless
import warnings import warnings
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
@ -25,7 +26,6 @@ from django.test.utils import override_settings
from django.utils import six from django.utils import six
from django.utils import timezone from django.utils import timezone
from django.utils.tzinfo import FixedOffset from django.utils.tzinfo import FixedOffset
from django.utils.unittest import skipIf, skipUnless
from .forms import EventForm, EventSplitForm, EventModelForm from .forms import EventForm, EventSplitForm, EventModelForm
from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayEvent from .models import Event, MaybeEvent, Session, SessionEvent, Timestamp, AllDayEvent

View File

@ -1,12 +1,12 @@
from __future__ import absolute_import from __future__ import absolute_import
import sys import sys
from unittest import skipIf, skipUnless
from django.db import connection, transaction, DatabaseError, IntegrityError from django.db import connection, transaction, DatabaseError, IntegrityError
from django.test import TransactionTestCase, skipUnlessDBFeature from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test.utils import IgnoreDeprecationWarningsMixin from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils import six from django.utils import six
from django.utils.unittest import skipIf, skipUnless
from .models import Reporter from .models import Reporter

Some files were not shown because too many files have changed in this diff Show More