summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorchillaranand <anand21nanda@gmail.com>2017-01-21 18:43:44 +0530
committerTim Graham <timograham@gmail.com>2017-01-25 12:23:46 -0500
commitd6eaf7c0183cd04b78f2a55e1d60bb7e59598310 (patch)
treeab02fd9949d4bfa23e27dea45e213ce334c883f0 /tests/staticfiles_tests
parentdc165ec8e5698ffc6dee6b510f1f92c9fd7467fe (diff)
Refs #23919 -- Replaced super(ClassName, self) with super().
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/cases.py4
-rw-r--r--tests/staticfiles_tests/test_finders.py6
-rw-r--r--tests/staticfiles_tests/test_liveserver.py8
-rw-r--r--tests/staticfiles_tests/test_management.py15
-rw-r--r--tests/staticfiles_tests/test_storage.py20
5 files changed, 26 insertions, 27 deletions
diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py
index 2305b34527..593739d401 100644
--- a/tests/staticfiles_tests/cases.py
+++ b/tests/staticfiles_tests/cases.py
@@ -62,7 +62,7 @@ class CollectionTestCase(BaseStaticFilesMixin, SimpleTestCase):
all these tests.
"""
def setUp(self):
- super(CollectionTestCase, self).setUp()
+ super().setUp()
temp_dir = tempfile.mkdtemp()
# Override the STATIC_ROOT for all tests from setUp to tearDown
# rather than as a context manager
@@ -74,7 +74,7 @@ class CollectionTestCase(BaseStaticFilesMixin, SimpleTestCase):
def tearDown(self):
self.patched_settings.disable()
- super(CollectionTestCase, self).tearDown()
+ super().tearDown()
def run_collectstatic(self, **kwargs):
verbosity = kwargs.pop('verbosity', 0)
diff --git a/tests/staticfiles_tests/test_finders.py b/tests/staticfiles_tests/test_finders.py
index 7df8c50a0d..0b661cb103 100644
--- a/tests/staticfiles_tests/test_finders.py
+++ b/tests/staticfiles_tests/test_finders.py
@@ -35,7 +35,7 @@ class TestFileSystemFinder(TestFinders, StaticFilesTestCase):
Test FileSystemFinder.
"""
def setUp(self):
- super(TestFileSystemFinder, self).setUp()
+ super().setUp()
self.finder = finders.FileSystemFinder()
test_file_path = os.path.join(TEST_ROOT, 'project', 'documents', 'test', 'file.txt')
self.find_first = (os.path.join('test', 'file.txt'), test_file_path)
@@ -47,7 +47,7 @@ class TestAppDirectoriesFinder(TestFinders, StaticFilesTestCase):
Test AppDirectoriesFinder.
"""
def setUp(self):
- super(TestAppDirectoriesFinder, self).setUp()
+ super().setUp()
self.finder = finders.AppDirectoriesFinder()
test_file_path = os.path.join(TEST_ROOT, 'apps', 'test', 'static', 'test', 'file1.txt')
self.find_first = (os.path.join('test', 'file1.txt'), test_file_path)
@@ -59,7 +59,7 @@ class TestDefaultStorageFinder(TestFinders, StaticFilesTestCase):
Test DefaultStorageFinder.
"""
def setUp(self):
- super(TestDefaultStorageFinder, self).setUp()
+ super().setUp()
self.finder = finders.DefaultStorageFinder(
storage=storage.StaticFilesStorage(location=settings.MEDIA_ROOT))
test_file_path = os.path.join(settings.MEDIA_ROOT, 'media-file.txt')
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py
index f45a95ba89..264242bbae 100644
--- a/tests/staticfiles_tests/test_liveserver.py
+++ b/tests/staticfiles_tests/test_liveserver.py
@@ -29,11 +29,11 @@ class LiveServerBase(StaticLiveServerTestCase):
# Override settings
cls.settings_override = override_settings(**TEST_SETTINGS)
cls.settings_override.enable()
- super(LiveServerBase, cls).setUpClass()
+ super().setUpClass()
@classmethod
def tearDownClass(cls):
- super(LiveServerBase, cls).tearDownClass()
+ super().tearDownClass()
# Restore original settings
cls.settings_override.disable()
@@ -57,14 +57,14 @@ class StaticLiveServerChecks(LiveServerBase):
@classmethod
def raises_exception(cls):
try:
- super(StaticLiveServerChecks, cls).setUpClass()
+ super().setUpClass()
raise Exception("The line above should have raised an exception")
except ImproperlyConfigured:
# This raises ImproperlyConfigured("You're using the staticfiles
# app without having set the required STATIC_URL setting.")
pass
finally:
- super(StaticLiveServerChecks, cls).tearDownClass()
+ super().tearDownClass()
def test_test_test(self):
# Intentionally empty method so that the test is picked up by the
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 5e1f49a5d3..ea58f9afb6 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -161,14 +161,14 @@ class TestCollectionClear(CollectionTestCase):
clear_filepath = os.path.join(settings.STATIC_ROOT, 'cleared.txt')
with open(clear_filepath, 'w') as f:
f.write('should be cleared')
- super(TestCollectionClear, self).run_collectstatic(clear=True)
+ super().run_collectstatic(clear=True)
def test_cleared_not_found(self):
self.assertFileNotFound('cleared.txt')
def test_dir_not_exists(self, **kwargs):
shutil.rmtree(settings.STATIC_ROOT)
- super(TestCollectionClear, self).run_collectstatic(clear=True)
+ super().run_collectstatic(clear=True)
@override_settings(STATICFILES_STORAGE='staticfiles_tests.storage.PathNotImplementedStorage')
def test_handle_path_notimplemented(self):
@@ -234,8 +234,7 @@ class TestCollectionExcludeNoDefaultIgnore(TestDefaults, CollectionTestCase):
``collectstatic`` management command.
"""
def run_collectstatic(self):
- super(TestCollectionExcludeNoDefaultIgnore, self).run_collectstatic(
- use_default_ignore_patterns=False)
+ super().run_collectstatic(use_default_ignore_patterns=False)
def test_no_common_ignore_patterns(self):
"""
@@ -266,7 +265,7 @@ class TestCollectionDryRun(TestNoFilesCreated, CollectionTestCase):
Test ``--dry-run`` option for ``collectstatic`` management command.
"""
def run_collectstatic(self):
- super(TestCollectionDryRun, self).run_collectstatic(dry_run=True)
+ super().run_collectstatic(dry_run=True)
class TestCollectionFilesOverride(CollectionTestCase):
@@ -308,10 +307,10 @@ class TestCollectionFilesOverride(CollectionTestCase):
with extend_sys_path(self.temp_dir):
self.settings_with_test_app.enable()
- super(TestCollectionFilesOverride, self).setUp()
+ super().setUp()
def tearDown(self):
- super(TestCollectionFilesOverride, self).tearDown()
+ super().tearDown()
self.settings_with_test_app.disable()
def test_ordering_override(self):
@@ -422,7 +421,7 @@ class TestCollectionLinks(TestDefaults, CollectionTestCase):
``--link`` does not change the file-selection semantics.
"""
def run_collectstatic(self, clear=False, link=True, **kwargs):
- super(TestCollectionLinks, self).run_collectstatic(link=link, clear=clear, **kwargs)
+ super().run_collectstatic(link=link, clear=clear, **kwargs)
def test_links_created(self):
"""
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index 2bbe912507..7e7b31fa67 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -27,7 +27,7 @@ class TestHashedFiles:
def setUp(self):
self._max_post_process_passes = storage.staticfiles_storage.max_post_process_passes
- super(TestHashedFiles, self).setUp()
+ super().setUp()
def tearDown(self):
# Clear hashed files to avoid side effects among tests.
@@ -305,7 +305,7 @@ class TestExtraPatternsCachedStorage(CollectionTestCase):
def setUp(self):
storage.staticfiles_storage.hashed_files.clear() # avoid cache interference
- super(TestExtraPatternsCachedStorage, self).setUp()
+ super().setUp()
def cached_file_path(self, path):
fullpath = self.render_template(self.static_template_snippet(path))
@@ -338,7 +338,7 @@ class TestCollectionManifestStorage(TestHashedFiles, CollectionTestCase):
Tests for the Cache busting storage
"""
def setUp(self):
- super(TestCollectionManifestStorage, self).setUp()
+ super().setUp()
temp_dir = tempfile.mkdtemp()
os.makedirs(os.path.join(temp_dir, 'test'))
@@ -359,7 +359,7 @@ class TestCollectionManifestStorage(TestHashedFiles, CollectionTestCase):
os.unlink(self._clear_filename)
storage.staticfiles_storage.manifest_strict = self._manifest_strict
- super(TestCollectionManifestStorage, self).tearDown()
+ super().tearDown()
def assertPostCondition(self):
hashed_files = storage.staticfiles_storage.hashed_files
@@ -446,7 +446,7 @@ class TestCollectionSimpleCachedStorage(CollectionTestCase):
def setUp(self):
storage.staticfiles_storage.hashed_files.clear() # avoid cache interference
- super(TestCollectionSimpleCachedStorage, self).setUp()
+ super().setUp()
def test_template_tag_return(self):
"""
@@ -474,7 +474,7 @@ class CustomStaticFilesStorage(storage.StaticFilesStorage):
def __init__(self, *args, **kwargs):
kwargs['file_permissions_mode'] = 0o640
kwargs['directory_permissions_mode'] = 0o740
- super(CustomStaticFilesStorage, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
@unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports chmod.")
@@ -489,11 +489,11 @@ class TestStaticFilePermissions(CollectionTestCase):
def setUp(self):
self.umask = 0o027
self.old_umask = os.umask(self.umask)
- super(TestStaticFilePermissions, self).setUp()
+ super().setUp()
def tearDown(self):
os.umask(self.old_umask)
- super(TestStaticFilePermissions, self).tearDown()
+ super().tearDown()
# Don't run collectstatic command in this test class.
def run_collectstatic(self, **kwargs):
@@ -556,12 +556,12 @@ class TestCollectionHashedFilesCache(CollectionTestCase):
)
with open(self.testimage_path, 'r+b') as f:
self._orig_image_content = f.read()
- super(TestCollectionHashedFilesCache, self).setUp()
+ super().setUp()
def tearDown(self):
with open(self.testimage_path, 'w+b') as f:
f.write(self._orig_image_content)
- super(TestCollectionHashedFilesCache, self).tearDown()
+ super().tearDown()
def test_file_change_after_collectstatic(self):
finders.get_finder.cache_clear()