summaryrefslogtreecommitdiff
path: root/tests/logging_tests/tests.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-02-05 09:11:54 -0800
committerTim Graham <timograham@gmail.com>2019-02-05 12:11:54 -0500
commit487d904bf253de2f5633f181a168f94086bcd6cb (patch)
treeb5b8bbe9e05ac5c4f978c9ede6061737f210322d /tests/logging_tests/tests.py
parent099c36d546cda842b44a93067d45e146e4ae77e5 (diff)
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.
Diffstat (limited to 'tests/logging_tests/tests.py')
-rw-r--r--tests/logging_tests/tests.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index 3ab905eab6..c19bfd7559 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -439,6 +439,7 @@ class SettingsConfigTest(AdminScriptTestCase):
a circular import error.
"""
def setUp(self):
+ super().setUp()
log_config = """{
'version': 1,
'handlers': {
@@ -450,9 +451,6 @@ class SettingsConfigTest(AdminScriptTestCase):
}"""
self.write_settings('settings.py', sdict={'LOGGING': log_config})
- def tearDown(self):
- self.remove_settings('settings.py')
-
def test_circular_dependency(self):
# validate is just an example command to trigger settings configuration
out, err = self.run_manage(['check'])
@@ -518,6 +516,7 @@ class SettingsCustomLoggingTest(AdminScriptTestCase):
callable in LOGGING_CONFIG (i.e., logging.config.fileConfig).
"""
def setUp(self):
+ super().setUp()
logging_conf = """
[loggers]
keys=root
@@ -544,7 +543,6 @@ format=%(message)s
def tearDown(self):
self.temp_file.close()
- self.remove_settings('settings.py')
def test_custom_logging(self):
out, err = self.run_manage(['check'])