summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_liveserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staticfiles_tests/test_liveserver.py')
-rw-r--r--tests/staticfiles_tests/test_liveserver.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/tests/staticfiles_tests/test_liveserver.py b/tests/staticfiles_tests/test_liveserver.py
index 970121f2da..38d1513c9a 100644
--- a/tests/staticfiles_tests/test_liveserver.py
+++ b/tests/staticfiles_tests/test_liveserver.py
@@ -29,22 +29,8 @@ class LiveServerBase(StaticLiveServerTestCase):
# Override settings
cls.settings_override = override_settings(**TEST_SETTINGS)
cls.settings_override.enable()
- try:
- super().setUpClass()
- except Exception:
- # Clean up since tearDownClass() isn't called on errors.
- cls._tearDownLiveServerBase()
- raise
-
- @classmethod
- def _tearDownLiveServerBase(cls):
- # Restore original settings
- cls.settings_override.disable()
-
- @classmethod
- def tearDownClass(cls):
- super().tearDownClass()
- cls._tearDownLiveServerBase()
+ cls.addClassCleanup(cls.settings_override.disable)
+ super().setUpClass()
class StaticLiveServerChecks(LiveServerBase):
@@ -74,8 +60,6 @@ class StaticLiveServerChecks(LiveServerBase):
# app without having set the required STATIC_URL setting.")
pass
else:
- # super().setUpClass() cleans up after itself on a failure.
- super().tearDownClass()
raise Exception('setUpClass() should have raised an exception.')
def test_test_test(self):