Always use Pythons builtin unittest module

As we've dropped Python 2.6, the builtin unittest module will always be
unittest2
This commit is contained in:
Karl Hobley 2014-12-15 20:44:53 +00:00
parent 1fa9ab35c0
commit 4e8a6b309f
9 changed files with 18 additions and 20 deletions

View file

@ -5,17 +5,6 @@ import threading
from django.contrib.auth import get_user_model
from django.utils import six
# We need to make sure that we're using the same unittest library that Django uses internally
# Otherwise, we get issues with the "SkipTest" and "ExpectedFailure" exceptions being recognised as errors
try:
# Firstly, try to import unittest from Django
from django.utils import unittest
except ImportError:
# Django doesn't include unittest
# We must be running on Django 1.7+ which doesn't support Python 2.6 so
# the standard unittest library should be unittest2
import unittest
class WagtailTestUtils(object):
def login(self):

View file

@ -1,4 +1,5 @@
from datetime import timedelta
import unittest
from django.test import TestCase
from django.core.urlresolvers import reverse
@ -13,7 +14,7 @@ from wagtail.tests.models import (
StandardIndex, StandardChild,
BusinessIndex, BusinessChild, BusinessSubIndex,
TaggedPage, Advert, AdvertPlacement)
from wagtail.tests.utils import unittest, WagtailTestUtils
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page, PageRevision
from wagtail.wagtailcore.signals import page_published, page_unpublished
from wagtail.wagtailusers.models import UserProfile

View file

@ -1,4 +1,5 @@
from six import b
import unittest
from django.test import TestCase
from django.contrib.auth import get_user_model
@ -7,7 +8,7 @@ from django.core.urlresolvers import reverse
from django.core.files.base import ContentFile
from django.test.utils import override_settings
from wagtail.tests.utils import unittest, WagtailTestUtils
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page
from wagtail.tests.models import EventPage, EventPageRelatedLink

View file

@ -3,6 +3,7 @@ from six.moves.urllib.error import URLError
from mock import patch
import warnings
import unittest
try:
import embedly
@ -13,7 +14,7 @@ except ImportError:
from django import template
from django.test import TestCase
from wagtail.tests.utils import WagtailTestUtils, unittest
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailembeds.embeds import (
EmbedNotFoundException,

View file

@ -1,3 +1,5 @@
import unittest
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
@ -8,7 +10,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.db.utils import IntegrityError
from django.db import connection
from wagtail.tests.utils import WagtailTestUtils, unittest, test_concurrently
from wagtail.tests.utils import WagtailTestUtils, test_concurrently
from wagtail.wagtailcore.models import Page
from wagtail.tests.models import EventPage, EventPageCarouselItem
from wagtail.wagtailimages.models import Rendition, Filter

View file

@ -1,12 +1,13 @@
from six import StringIO
import warnings
import unittest
from django.test import TestCase
from django.test.utils import override_settings
from django.conf import settings
from django.core import management
from wagtail.tests.utils import unittest, WagtailTestUtils
from wagtail.tests.utils import WagtailTestUtils
from wagtail.tests import models
from wagtail.wagtailsearch.backends import get_search_backend, InvalidSearchBackendError
from wagtail.wagtailsearch.backends.db import DBSearch

View file

@ -1,4 +1,4 @@
from wagtail.tests.utils import unittest
import unittest
from django.test import TestCase

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from wagtail.tests.utils import unittest
import unittest
import datetime
import json

View file

@ -1,14 +1,17 @@
from __future__ import unicode_literals
import unittest
import six
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from wagtail.tests.utils import WagtailTestUtils, unittest
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore import hooks
from wagtail.wagtailusers.models import UserProfile
from wagtail.wagtailcore.models import Page, GroupPagePermission
import six
class TestUserIndexView(TestCase, WagtailTestUtils):