From: Scott Worley Date: Thu, 23 Nov 2023 20:39:13 +0000 (-0800) Subject: fetch: test: Explicitly join webserver thread X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/e3ba205699db054723578a32d1bf73276b0e58ad fetch: test: Explicitly join webserver thread --- diff --git a/paperdoorknob_test.py b/paperdoorknob_test.py index fafd1c3..b1d41d4 100644 --- a/paperdoorknob_test.py +++ b/paperdoorknob_test.py @@ -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)