From 7b2f2e74adb36a4334e83130f6abc2f79d395235 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 29 Dec 2016 16:27:49 +0100 Subject: Refs #23919 -- Removed six._types usage Thanks Tim Graham and Simon Charette for the reviews. --- tests/staticfiles_tests/cases.py | 5 ++--- tests/staticfiles_tests/test_management.py | 6 +++--- tests/staticfiles_tests/test_storage.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'tests/staticfiles_tests') diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py index f278e6a974..069402c6f6 100644 --- a/tests/staticfiles_tests/cases.py +++ b/tests/staticfiles_tests/cases.py @@ -7,7 +7,6 @@ from django.conf import settings from django.core.management import call_command from django.template import Context, Template from django.test import SimpleTestCase, override_settings -from django.utils import six from django.utils.encoding import force_text from .settings import TEST_SETTINGS @@ -30,7 +29,7 @@ class BaseStaticFilesMixin(object): self._get_file(filepath) def render_template(self, template, **kwargs): - if isinstance(template, six.string_types): + if isinstance(template, str): template = Template(template) return template.render(Context(**kwargs)).strip() @@ -72,7 +71,7 @@ class CollectionTestCase(BaseStaticFilesMixin, SimpleTestCase): self.patched_settings.enable() self.run_collectstatic() # Same comment as in runtests.teardown. - self.addCleanup(shutil.rmtree, six.text_type(temp_dir)) + self.addCleanup(shutil.rmtree, temp_dir) def tearDown(self): self.patched_settings.disable() diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py index e8c00eb3f5..7d17f2abe1 100644 --- a/tests/staticfiles_tests/test_management.py +++ b/tests/staticfiles_tests/test_management.py @@ -166,7 +166,7 @@ class TestCollectionClear(CollectionTestCase): self.assertFileNotFound('cleared.txt') def test_dir_not_exists(self, **kwargs): - shutil.rmtree(six.text_type(settings.STATIC_ROOT)) + shutil.rmtree(settings.STATIC_ROOT) super(TestCollectionClear, self).run_collectstatic(clear=True) @override_settings(STATICFILES_STORAGE='staticfiles_tests.storage.PathNotImplementedStorage') @@ -210,7 +210,7 @@ class TestInteractiveMessages(CollectionTestCase): def test_no_warning_when_staticdir_does_not_exist(self): stdout = six.StringIO() - shutil.rmtree(six.text_type(settings.STATIC_ROOT)) + shutil.rmtree(settings.STATIC_ROOT) call_command('collectstatic', interactive=True, stdout=stdout) output = force_text(stdout.getvalue()) self.assertNotIn(self.overwrite_warning_msg, output) @@ -222,7 +222,7 @@ class TestInteractiveMessages(CollectionTestCase): static_dir = tempfile.mkdtemp(prefix='collectstatic_empty_staticdir_test') with override_settings(STATIC_ROOT=static_dir): call_command('collectstatic', interactive=True, stdout=stdout) - shutil.rmtree(six.text_type(static_dir)) + shutil.rmtree(static_dir) output = force_text(stdout.getvalue()) self.assertNotIn(self.overwrite_warning_msg, output) self.assertNotIn(self.delete_warning_msg, output) diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index d1b7a49626..6333be7549 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -350,7 +350,7 @@ class TestCollectionManifestStorage(TestHashedFiles, CollectionTestCase): self.patched_settings = self.settings( STATICFILES_DIRS=settings.STATICFILES_DIRS + [temp_dir]) self.patched_settings.enable() - self.addCleanup(shutil.rmtree, six.text_type(temp_dir)) + self.addCleanup(shutil.rmtree, temp_dir) self._manifest_strict = storage.staticfiles_storage.manifest_strict def tearDown(self): -- cgit v1.3