MCPcopy
hub / github.com/django/django / setUp

Method setUp

tests/staticfiles_tests/test_storage.py:445–460  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

443 """
444
445 def setUp(self):
446 super().setUp()
447
448 temp_dir = tempfile.mkdtemp()
449 os.makedirs(os.path.join(temp_dir, "test"))
450 self._clear_filename = os.path.join(temp_dir, "test", "cleared.txt")
451 with open(self._clear_filename, "w") as f:
452 f.write("to be deleted in one test")
453
454 patched_settings = self.settings(
455 STATICFILES_DIRS=settings.STATICFILES_DIRS + [temp_dir],
456 )
457 patched_settings.enable()
458 self.addCleanup(patched_settings.disable)
459 self.addCleanup(shutil.rmtree, temp_dir)
460 self._manifest_strict = storage.staticfiles_storage.manifest_strict
461
462 def tearDown(self):
463 if os.path.exists(self._clear_filename):

Callers

nothing calls this directly

Calls 6

setUpMethod · 0.45
mkdtempMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45
settingsMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected