Skip to content

Commit

Permalink
Use a context manager for temp_dir to ensure it gets cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-mather committed Mar 26, 2024
1 parent 6f2a1f7 commit e0f4b9f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_static_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def test_manifest_static_files_storage(self):
.map files can cause this to fail if the static
files refer to them (GH issue #460)
"""
temp_dir = tempfile.mkdtemp()
with self.settings(
STATIC_ROOT=temp_dir,
STATICFILES_STORAGE="django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
):
result = call_command("collectstatic", "--no-input")
self.assertRegex(result, r"\d+ static files copied")
with tempfile.TemporaryDirectory() as temp_dir:
with self.settings(
STATIC_ROOT=temp_dir,
STATICFILES_STORAGE="django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
):
result = call_command("collectstatic", "--no-input")
self.assertRegex(result, r"\d+ static files copied")

0 comments on commit e0f4b9f

Please sign in to comment.