mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user