summaryrefslogtreecommitdiff
path: root/tests/test_runner
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/test_runner
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/test_runner')
-rw-r--r--tests/test_runner/tests.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py
index 43c605eba6..3f4e257261 100644
--- a/tests/test_runner/tests.py
+++ b/tests/test_runner/tests.py
@@ -155,14 +155,12 @@ class CustomTestRunnerOptionsSettingsTests(AdminScriptTestCase):
through a settings file.
"""
def setUp(self):
+ super().setUp()
settings = {
'TEST_RUNNER': '\'test_runner.runner.CustomOptionsTestRunner\'',
}
self.write_settings('settings.py', sdict=settings)
- def tearDown(self):
- self.remove_settings('settings.py')
-
def test_default_options(self):
args = ['test', '--settings=test_project.settings']
out, err = self.run_django_admin(args)
@@ -195,11 +193,9 @@ class CustomTestRunnerOptionsCmdlineTests(AdminScriptTestCase):
using --testrunner.
"""
def setUp(self):
+ super().setUp()
self.write_settings('settings.py')
- def tearDown(self):
- self.remove_settings('settings.py')
-
def test_testrunner_option(self):
args = [
'test', '--testrunner', 'test_runner.runner.CustomOptionsTestRunner',
@@ -228,11 +224,9 @@ class CustomTestRunnerOptionsCmdlineTests(AdminScriptTestCase):
class Ticket17477RegressionTests(AdminScriptTestCase):
def setUp(self):
+ super().setUp()
self.write_settings('settings.py')
- def tearDown(self):
- self.remove_settings('settings.py')
-
def test_ticket_17477(self):
"""'manage.py help test' works after r16352."""
args = ['help', 'test']