mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Used addCleanup() in tests where appropriate.
This commit is contained in:
@@ -579,20 +579,18 @@ args=(sys.stdout,)
|
||||
[formatter_simple]
|
||||
format=%(message)s
|
||||
"""
|
||||
self.temp_file = NamedTemporaryFile()
|
||||
self.temp_file.write(logging_conf.encode())
|
||||
self.temp_file.flush()
|
||||
temp_file = NamedTemporaryFile()
|
||||
temp_file.write(logging_conf.encode())
|
||||
temp_file.flush()
|
||||
self.addCleanup(temp_file.close)
|
||||
self.write_settings(
|
||||
"settings.py",
|
||||
sdict={
|
||||
"LOGGING_CONFIG": '"logging.config.fileConfig"',
|
||||
"LOGGING": 'r"%s"' % self.temp_file.name,
|
||||
"LOGGING": 'r"%s"' % temp_file.name,
|
||||
},
|
||||
)
|
||||
|
||||
def tearDown(self):
|
||||
self.temp_file.close()
|
||||
|
||||
def test_custom_logging(self):
|
||||
out, err = self.run_manage(["check"])
|
||||
self.assertNoOutput(err)
|
||||
|
||||
Reference in New Issue
Block a user