summaryrefslogtreecommitdiff
path: root/tests/fixtures
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-01-07 12:11:46 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 21:33:28 +0100
commit2b281cc35ed9d997614ca3c416928d7fabfef1ad (patch)
treed3e73cf44b15139aa9f1f53e398942ba64f5e190 /tests/fixtures
parent7b2f2e74adb36a4334e83130f6abc2f79d395235 (diff)
downloaddjango-2b281cc35ed9d997614ca3c416928d7fabfef1ad.tar.gz
Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/fixtures')
-rw-r--r--tests/fixtures/tests.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py
index df5067e223..51d8eef51b 100644
--- a/tests/fixtures/tests.py
+++ b/tests/fixtures/tests.py
@@ -3,6 +3,7 @@ import sys
import tempfile
import unittest
import warnings
+from io import StringIO
from django.apps import apps
from django.contrib.sites.models import Site
@@ -15,7 +16,6 @@ from django.db import IntegrityError, connection
from django.test import (
TestCase, TransactionTestCase, mock, skipUnlessDBFeature,
)
-from django.utils import six
from django.utils.encoding import force_text
from .models import (
@@ -52,7 +52,7 @@ class DumpDataAssertMixin(object):
def _dumpdata_assert(self, args, output, format='json', filename=None,
natural_foreign_keys=False, natural_primary_keys=False,
use_base_manager=False, exclude_list=[], primary_keys=''):
- new_io = six.StringIO()
+ new_io = StringIO()
if filename:
filename = os.path.join(tempfile.gettempdir(), filename)
management.call_command('dumpdata', *args, **{'format': format,
@@ -445,7 +445,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
def test_dumpdata_with_uuid_pks(self):
m1 = PrimaryKeyUUIDModel.objects.create()
m2 = PrimaryKeyUUIDModel.objects.create()
- output = six.StringIO()
+ output = StringIO()
management.call_command(
'dumpdata', 'fixtures.PrimaryKeyUUIDModel', '--pks', ', '.join([str(m1.id), str(m2.id)]),
stdout=output,
@@ -471,7 +471,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
stdout is a tty, and verbosity > 0.
"""
management.call_command('loaddata', 'fixture1.json', verbosity=0)
- new_io = six.StringIO()
+ new_io = StringIO()
new_io.isatty = lambda: True
with NamedTemporaryFile() as file:
options = {
@@ -485,7 +485,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
# Test no progress bar when verbosity = 0
options['verbosity'] = 0
- new_io = six.StringIO()
+ new_io = StringIO()
new_io.isatty = lambda: True
options.update({'stdout': new_io, 'stderr': new_io})
management.call_command('dumpdata', 'fixtures', **options)
@@ -583,7 +583,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
])
def test_loaddata_verbosity_three(self):
- output = six.StringIO()
+ output = StringIO()
management.call_command('loaddata', 'fixture1.json', verbosity=3, stdout=output, stderr=output)
command_output = force_text(output.getvalue())
self.assertIn(
@@ -689,7 +689,7 @@ class NonExistentFixtureTests(TestCase):
"""
def test_loaddata_not_existent_fixture_file(self):
- stdout_output = six.StringIO()
+ stdout_output = StringIO()
with self.assertRaisesMessage(CommandError, "No fixture named 'this_fixture_doesnt_exist' found."):
management.call_command('loaddata', 'this_fixture_doesnt_exist', stdout=stdout_output)