summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_storage.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staticfiles_tests/test_storage.py')
-rw-r--r--tests/staticfiles_tests/test_storage.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index ea2293ccde..1e537dfe54 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -417,16 +417,15 @@ class TestCollectionManifestStorage(TestHashedFiles, CollectionTestCase):
with open(self._clear_filename, "w") as f:
f.write("to be deleted in one test")
- self.patched_settings = self.settings(
+ patched_settings = self.settings(
STATICFILES_DIRS=settings.STATICFILES_DIRS + [temp_dir],
)
- self.patched_settings.enable()
+ patched_settings.enable()
+ self.addCleanup(patched_settings.disable)
self.addCleanup(shutil.rmtree, temp_dir)
self._manifest_strict = storage.staticfiles_storage.manifest_strict
def tearDown(self):
- self.patched_settings.disable()
-
if os.path.exists(self._clear_filename):
os.unlink(self._clear_filename)
@@ -702,13 +701,13 @@ class CustomManifestStorage(storage.ManifestStaticFilesStorage):
class TestCustomManifestStorage(SimpleTestCase):
def setUp(self):
- self.manifest_path = Path(tempfile.mkdtemp())
- self.addCleanup(shutil.rmtree, self.manifest_path)
+ manifest_path = Path(tempfile.mkdtemp())
+ self.addCleanup(shutil.rmtree, manifest_path)
self.staticfiles_storage = CustomManifestStorage(
- manifest_location=self.manifest_path,
+ manifest_location=manifest_path,
)
- self.manifest_file = self.manifest_path / self.staticfiles_storage.manifest_name
+ self.manifest_file = manifest_path / self.staticfiles_storage.manifest_name
# Manifest without paths.
self.manifest = {"version": self.staticfiles_storage.manifest_version}
with self.manifest_file.open("w") as manifest_file:
@@ -762,13 +761,10 @@ class TestStaticFilePermissions(CollectionTestCase):
def setUp(self):
self.umask = 0o027
- self.old_umask = os.umask(self.umask)
+ old_umask = os.umask(self.umask)
+ self.addCleanup(os.umask, old_umask)
super().setUp()
- def tearDown(self):
- os.umask(self.old_umask)
- super().tearDown()
-
# Don't run collectstatic command in this test class.
def run_collectstatic(self, **kwargs):
pass