mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Simplified temporary directory handling in AdminScriptTestCase.
Use tempfile.TemporaryDirectory() in AdminScriptTestCase.setUp() to create and destroy a temporary directory for each test. It removes the need for individual tests to delete files. For test classes that don't use the temporary directory, inherit from SimpleTestCase.
This commit is contained in:
parent
099c36d546
commit
487d904bf2
5 changed files with 30 additions and 140 deletions
|
@ -534,14 +534,12 @@ class ReverseLazySettingsTest(AdminScriptTestCase):
|
|||
import error.
|
||||
"""
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.write_settings(
|
||||
'settings.py',
|
||||
extra="from django.urls import reverse_lazy\nLOGIN_URL = reverse_lazy('login')",
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
self.remove_settings('settings.py')
|
||||
|
||||
def test_lazy_in_settings(self):
|
||||
out, err = self.run_manage(['check'])
|
||||
self.assertNoOutput(err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue