]> git.scottworley.com Git - paperdoorknob/commitdiff
fetch: test: Explicitly join webserver thread
authorScott Worley <scottworley@scottworley.com>
Thu, 23 Nov 2023 20:39:13 +0000 (12:39 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:37:10 +0000 (17:37 -0800)
paperdoorknob_test.py

index fafd1c37284c80486f0859aa33c39e0e2728153d..b1d41d493574103bc5b22696d72454a43c33d07e 100644 (file)
@@ -36,11 +36,13 @@ class TestFetch(unittest.TestCase):
     def setUp(self) -> None:
         web_server = HTTPServer(('', 0), FakeGlowficHTTPRequestHandler)
         self._port = web_server.socket.getsockname()[1]
-        threading.Thread(target=web_server.serve_forever).start()
+        self._thread = threading.Thread(target=web_server.serve_forever)
+        self._thread.start()
         self._stop_server = web_server.shutdown
 
     def tearDown(self) -> None:
         self._stop_server()
+        self._thread.join()
 
     def testFetch(self) -> None:
         paperdoorknob.fetch(f"http://localhost:{self._port}", TIMEOUT)