bpo-30908: Fix dangling thread in test_os.TestSendfile (#2680) (#2844)

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
(cherry picked from commit d1cc037d14)
This commit is contained in:
Victor Stinner 2017-07-24 17:40:50 +02:00 committed by GitHub
parent 1daeb25979
commit bb33ccfc5a
1 changed files with 1 additions and 0 deletions

View File

@ -2621,6 +2621,7 @@ class TestSendfile(unittest.TestCase):
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