[Python-checkins] bpo-31234: Join threads in test_threading (#3579)
Victor Stinner
webhook-mailer at python.org
Thu Sep 14 16:05:24 EDT 2017
https://github.com/python/cpython/commit/b8c7be2c523b012e57915182543d06657161057f
commit: b8c7be2c523b012e57915182543d06657161057f
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-09-14T13:05:21-07:00
summary:
bpo-31234: Join threads in test_threading (#3579)
Call thread.join() to prevent the "dangling thread" warning.
files:
M Lib/test/test_threading.py
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 912eb3fa67a..ab383c23332 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -578,6 +578,7 @@ def f():
self.assertFalse(t.is_alive())
# And verify the thread disposed of _tstate_lock.
self.assertIsNone(t._tstate_lock)
+ t.join()
def test_repr_stopped(self):
# Verify that "stopped" shows up in repr(Thread) appropriately.
@@ -604,6 +605,7 @@ def f():
break
time.sleep(0.01)
self.assertIn(LOOKING_FOR, repr(t)) # we waited at least 5 seconds
+ t.join()
def test_BoundedSemaphore_limit(self):
# BoundedSemaphore should raise ValueError if released too often.
@@ -918,6 +920,7 @@ def test_start_thread_again(self):
thread = threading.Thread()
thread.start()
self.assertRaises(RuntimeError, thread.start)
+ thread.join()
def test_joining_current_thread(self):
current_thread = threading.current_thread()
@@ -931,6 +934,7 @@ def test_daemonize_active_thread(self):
thread = threading.Thread()
thread.start()
self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
+ thread.join()
def test_releasing_unacquired_lock(self):
lock = threading.Lock()
More information about the Python-checkins
mailing list