From 146f26c5f879ce41a2545eb7d9240f282a251354 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 19 Apr 2018 21:26:29 -0400 Subject: [PATCH] deprecate django unittest --- core/tests.py | 6 +++--- payment/stripelib.py | 13 +++++-------- payment/tests.py | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/core/tests.py b/core/tests.py index d3bc54e7..9f06b2cc 100755 --- a/core/tests.py +++ b/core/tests.py @@ -5,9 +5,10 @@ import os from datetime import datetime, timedelta from decimal import Decimal as D from math import factorial -from time import sleep, mktime +import unittest from urlparse import parse_qs, urlparse from tempfile import NamedTemporaryFile +from time import sleep, mktime from celery.task.sets import TaskSet import requests @@ -25,7 +26,6 @@ from django.http import Http404 from django.test import TestCase from django.test.client import Client from django.test.utils import override_settings -from django.utils import unittest from django_comments.models import Comment @@ -162,7 +162,7 @@ class BookLoaderTests(TestCase): if not (mocking or settings.TEST_INTEGRATION): return edition = bookloader.add_by_isbn('9787104030126') - self.assertEqual(edition.work.language, 'zh-CN') + self.assertEqual(edition.work.language, u'zh-CN') def test_update_edition_mock(self): with requests_mock.Mocker(real_http=True) as m: diff --git a/payment/stripelib.py b/payment/stripelib.py index 9cea6917..f916d593 100644 --- a/payment/stripelib.py +++ b/payment/stripelib.py @@ -6,12 +6,15 @@ external library imports """ import logging import json -import re -import stripe from datetime import datetime, timedelta from itertools import islice from pytz import utc +import re +import unittest +from unittest import TestCase + +import stripe """ django imports @@ -73,12 +76,6 @@ def grouper(iterable, page_size): class StripelibError(baseprocessor.ProcessorError): pass -try: - import unittest - from unittest import TestCase -except: - from django.test import TestCase - from django.utils import unittest # if customer.id doesn't exist, create one and then charge the customer # we probably should ask our users whether they are ok with our creating a customer id account -- or ask for credit diff --git a/payment/tests.py b/payment/tests.py index 07ffaa9a..88a398cf 100644 --- a/payment/tests.py +++ b/payment/tests.py @@ -5,6 +5,7 @@ import logging import os import time import traceback +import unittest from datetime import timedelta from decimal import Decimal as D @@ -19,7 +20,6 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.test import TestCase -from django.utils import unittest """ regluit imports