Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Used compatible imports of StringIO.

  • Loading branch information...
commit 396357741b88dfcd85486db673dbb822da8b2de0 1 parent 2da3af2
@aaugustin aaugustin authored
View
9 tests/modeltests/fixtures/tests.py
@@ -1,11 +1,10 @@
from __future__ import absolute_import
-import StringIO
-
from django.contrib.sites.models import Site
from django.core import management
from django.db import connection, IntegrityError
from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
+from django.utils.six import StringIO
from .models import Article, Book, Spy, Tag, Visa
@@ -26,7 +25,7 @@ class FixtureLoadingTests(TestCase):
def _dumpdata_assert(self, args, output, format='json', natural_keys=False,
use_base_manager=False, exclude_list=[]):
- new_io = StringIO.StringIO()
+ new_io = StringIO()
management.call_command('dumpdata', *args, **{'format':format,
'stdout':new_io,
'stderr':new_io,
@@ -43,7 +42,7 @@ def test_initial_data(self):
])
def test_loading_and_dumping(self):
- new_io = StringIO.StringIO()
+ new_io = StringIO()
Site.objects.all().delete()
# Load fixture 1. Single JSON file, with two objects.
@@ -293,7 +292,7 @@ def test_output_formats(self):
class FixtureTransactionTests(TransactionTestCase):
def _dumpdata_assert(self, args, output, format='json'):
- new_io = StringIO.StringIO()
+ new_io = StringIO()
management.call_command('dumpdata', *args, **{'format':format, 'stdout':new_io})
command_output = new_io.getvalue().strip()
self.assertEqual(command_output, output)
View
2  tests/modeltests/serializers/tests.py
@@ -4,13 +4,13 @@
import json
from datetime import datetime
from xml.dom import minidom
-from StringIO import StringIO
from django.conf import settings
from django.core import serializers
from django.db import transaction, connection
from django.test import TestCase, TransactionTestCase, Approximate
from django.utils import six
+from django.utils.six import StringIO
from django.utils import unittest
from .models import (Category, Author, Article, AuthorProfile, Actor, Movie,
View
2  tests/modeltests/user_commands/tests.py
@@ -1,10 +1,10 @@
import sys
-from StringIO import StringIO
from django.core import management
from django.core.management.base import CommandError
from django.test import TestCase
from django.utils import translation
+from django.utils.six import StringIO
class CommandTests(TestCase):
View
4 tests/regressiontests/bash_completion/tests.py
@@ -3,11 +3,11 @@
"""
import os
import sys
-import StringIO
from django.conf import settings
from django.core.management import ManagementUtility
from django.utils import unittest
+from django.utils.six import StringIO
class BashCompletionTests(unittest.TestCase):
@@ -20,7 +20,7 @@ class BashCompletionTests(unittest.TestCase):
def setUp(self):
self.old_DJANGO_AUTO_COMPLETE = os.environ.get('DJANGO_AUTO_COMPLETE')
os.environ['DJANGO_AUTO_COMPLETE'] = '1'
- self.output = StringIO.StringIO()
+ self.output = StringIO()
self.old_stdout = sys.stdout
sys.stdout = self.output
View
3  tests/regressiontests/builtin_server/tests.py
@@ -1,6 +1,5 @@
-from StringIO import StringIO
-
from django.core.servers.basehttp import ServerHandler
+from django.utils.six import StringIO
from django.utils.unittest import TestCase
#
View
3  tests/regressiontests/createsuperuser/tests.py
@@ -1,9 +1,8 @@
-from StringIO import StringIO
-
from django.contrib.auth import models
from django.contrib.auth.management.commands import changepassword
from django.core.management import call_command
from django.test import TestCase
+from django.utils.six import StringIO
class MultiDBChangepasswordManagementCommandTestCase(TestCase):
View
2  tests/regressiontests/file_uploads/tests.py
@@ -7,12 +7,12 @@
import json
import os
import shutil
-from StringIO import StringIO
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http.multipartparser import MultiPartParser
from django.test import TestCase, client
+from django.utils.six import StringIO
from django.utils import unittest
from . import uploadhandler
View
2  tests/regressiontests/i18n/commands/extraction.py
@@ -3,10 +3,10 @@
import os
import re
import shutil
-from StringIO import StringIO
from django.core import management
from django.test import TestCase
+from django.utils.six import StringIO
LOCALE='de'
View
3  tests/regressiontests/inspectdb/tests.py
@@ -1,7 +1,6 @@
-from StringIO import StringIO
-
from django.core.management import call_command
from django.test import TestCase, skipUnlessDBFeature
+from django.utils.six import StringIO
class InspectDBTestCase(TestCase):
View
2  tests/regressiontests/mail/tests.py
@@ -7,7 +7,6 @@
import shutil
import smtpd
import sys
-from StringIO import StringIO
import tempfile
import threading
@@ -18,6 +17,7 @@
from django.core.mail.message import BadHeaderError
from django.test import TestCase
from django.test.utils import override_settings
+from django.utils.six import StringIO
from django.utils.translation import ugettext_lazy
View
4 tests/regressiontests/middleware/tests.py
@@ -3,7 +3,6 @@
import gzip
import re
import random
-import StringIO
from django.conf import settings
from django.core import mail
@@ -16,6 +15,7 @@
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.utils.six.moves import xrange
+from django.utils.six import StringIO
class CommonMiddlewareTest(TestCase):
def setUp(self):
@@ -526,7 +526,7 @@ def setUp(self):
@staticmethod
def decompress(gzipped_string):
- return gzip.GzipFile(mode='rb', fileobj=StringIO.StringIO(gzipped_string)).read()
+ return gzip.GzipFile(mode='rb', fileobj=StringIO(gzipped_string)).read()
def test_compress_response(self):
"""
View
2  tests/regressiontests/multiple_database/tests.py
@@ -2,7 +2,6 @@
import datetime
import pickle
-from StringIO import StringIO
from django.conf import settings
from django.contrib.auth.models import User
@@ -11,6 +10,7 @@
from django.db import connections, router, DEFAULT_DB_ALIAS
from django.db.models import signals
from django.test import TestCase
+from django.utils.six import StringIO
from .models import Book, Person, Pet, Review, UserProfile
View
2  tests/regressiontests/requests/tests.py
@@ -3,7 +3,6 @@
import time
import warnings
from datetime import datetime, timedelta
-from StringIO import StringIO
from django.conf import settings
from django.core.handlers.wsgi import WSGIRequest, LimitedStream
@@ -11,6 +10,7 @@
from django.test.utils import str_prefix
from django.utils import unittest
from django.utils.http import cookie_date
+from django.utils.six import StringIO
from django.utils.timezone import utc
View
6 tests/regressiontests/templates/loaders.py
@@ -12,13 +12,13 @@
import sys
import pkg_resources
import imp
-import StringIO
import os.path
from django.template import TemplateDoesNotExist, Context
from django.template.loaders.eggs import Loader as EggLoader
from django.template import loader
from django.utils import unittest
+from django.utils.six import StringIO
# Mock classes and objects for pkg_resources functions.
@@ -61,8 +61,8 @@ def setUp(self):
self.empty_egg = create_egg("egg_empty", {})
self.egg_1 = create_egg("egg_1", {
- os.path.normcase('templates/y.html') : StringIO.StringIO("y"),
- os.path.normcase('templates/x.txt') : StringIO.StringIO("x"),
+ os.path.normcase('templates/y.html') : StringIO("y"),
+ os.path.normcase('templates/x.txt') : StringIO("x"),
})
self._old_installed_apps = settings.INSTALLED_APPS
settings.INSTALLED_APPS = []
View
2  tests/regressiontests/test_utils/tests.py
@@ -493,7 +493,7 @@ class MyCustomField(IntegerField):
# Standard doctests do fairly
>>> import json
>>> from django.utils.xmlutils import SimplerXMLGenerator
->>> from StringIO import StringIO
+>>> from django.utils.six import StringIO
>>> def produce_long():
... return 42L
Please sign in to comment.
Something went wrong with that request. Please try again.