Skip to content

Commit

Permalink
bpo-30908: Fix dangling thread in test_os.TestSendfile (#2680) (#2845)
Browse files Browse the repository at this point in the history
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 d1cc037)
  • Loading branch information
vstinner committed Jul 24, 2017
1 parent dbe6aba commit 157b6ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lib/test/test_os.py
Expand Up @@ -2443,6 +2443,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
Expand Down

0 comments on commit 157b6ad

Please sign in to comment.