summaryrefslogtreecommitdiff
path: root/tests/servers/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/servers/tests.py')
-rw-r--r--tests/servers/tests.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index 66f0af1604..8796db9749 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -377,12 +377,15 @@ class LiveServerPort(LiveServerBase):
return
# Unexpected error.
raise
- self.assertNotEqual(
- self.live_server_url,
- TestCase.live_server_url,
- f"Acquired duplicate server addresses for server threads: "
- f"{self.live_server_url}",
- )
+ try:
+ self.assertNotEqual(
+ self.live_server_url,
+ TestCase.live_server_url,
+ f"Acquired duplicate server addresses for server threads: "
+ f"{self.live_server_url}",
+ )
+ finally:
+ TestCase.doClassCleanups()
def test_specified_port_bind(self):
"""LiveServerTestCase.port customizes the server's port."""
@@ -393,12 +396,15 @@ class LiveServerPort(LiveServerBase):
TestCase.port = s.getsockname()[1]
s.close()
TestCase._start_server_thread()
- self.assertEqual(
- TestCase.port,
- TestCase.server_thread.port,
- f"Did not use specified port for LiveServerTestCase thread: "
- f"{TestCase.port}",
- )
+ try:
+ self.assertEqual(
+ TestCase.port,
+ TestCase.server_thread.port,
+ f"Did not use specified port for LiveServerTestCase thread: "
+ f"{TestCase.port}",
+ )
+ finally:
+ TestCase.doClassCleanups()
class LiveServerThreadedTests(LiveServerBase):