]> granicus.if.org Git - python/commitdiff
bpo-30908: Fix dangling thread in test_os.TestSendfile (#2680)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 12 Jul 2017 14:05:43 +0000 (16:05 +0200)
committerGitHub <noreply@github.com>
Wed, 12 Jul 2017 14:05:43 +0000 (16:05 +0200)
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

index 5ff18cea13479b425a5f345e257114ee3a822aa8..611692f764473f8a75e2a6cc8ddcdcc95c51a3ba 100644 (file)
@@ -2639,6 +2639,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