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

Method setUp

tests/staticfiles_tests/cases.py:69–80  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

67 run_collectstatic_in_setUp = True
68
69 def setUp(self):
70 super().setUp()
71 temp_dir = self.mkdtemp()
72 # Override the STATIC_ROOT for all tests from setUp to tearDown
73 # rather than as a context manager
74 patched_settings = self.settings(STATIC_ROOT=temp_dir)
75 patched_settings.enable()
76 if self.run_collectstatic_in_setUp:
77 self.run_collectstatic()
78 # Same comment as in runtests.teardown.
79 self.addCleanup(shutil.rmtree, temp_dir)
80 self.addCleanup(patched_settings.disable)
81
82 def mkdtemp(self):
83 return tempfile.mkdtemp()

Callers

nothing calls this directly

Calls 4

mkdtempMethod · 0.95
run_collectstaticMethod · 0.95
settingsMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected