From a1524a8e0e0e770b5fa15d3f60f997599154b8a7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 12 Jul 2017 15:39:53 +0200 Subject: [PATCH] bpo-30908: Fix dangling thread in test_os.TestSendfile tearDown() now clears explicitly the self.server variable to make sure that the thread is completely cleared when tearDownClass() checks if all threads have been cleaned up. Fix the following warning: $ ./python -m test --fail-env-changed -m test.test_os.TestSendfile.test_keywords -R 3:1 test_os (...) Warning -- threading_cleanup() failed to cleanup 0 threads after 3 sec (count: 0, dangling: 2) (...) Tests result: ENV CHANGED --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5ff18cea13479b4..611692f764473f8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2639,6 +2639,7 @@ def tearDown(self): self.client.close() if self.server.running: self.server.stop() + self.server = None def sendfile_wrapper(self, sock, file, offset, nbytes, headers=[], trailers=[]): """A higher level wrapper representing how an application is