From 6924ed55c9807d69757e03bbe1caeec1104efacb Mon Sep 17 00:00:00 2001 From: grzgrzgrz3 Date: Mon, 15 May 2017 21:01:07 +0200 Subject: [PATCH] bpo-30357 each test in test_thread waits until all spawned threads finish (#1583) * bpo-30357 each test in test_thread waits until all spawn threads finish * bpo-30357 each test in test_thread waits until all spawn threads finish * bpo-30357: test_thread now uses threading_cleanup() (#1592) test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner * bpo-30357: test_thread now uses threading_cleanup() (#1592) test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner --- Lib/test/test_thread.py | 4 ++++ Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index b466138761..2f9abe078f 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -22,6 +22,7 @@ def verbose_print(arg): print arg + class BasicThreadTest(unittest.TestCase): def setUp(self): @@ -33,6 +34,9 @@ class BasicThreadTest(unittest.TestCase): self.running = 0 self.next_ident = 0 + key = test_support.threading_setup() + self.addCleanup(test_support.threading_cleanup, *key) + class ThreadRunningTests(BasicThreadTest): diff --git a/Misc/ACKS b/Misc/ACKS index 96cc90ed36..01bcd3b834 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -507,6 +507,7 @@ Fabian Groffen Eric Groo Dag Gruneau Filip Gruszczyński +Grzegorz Grzywacz Thomas Guettler Anuj Gupta Michael Guravage diff --git a/Misc/NEWS b/Misc/NEWS index 9b551dca90..059f2b3086 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12109,6 +12109,10 @@ IDLE Tests ----- +- bpo-30357: test_thread: setUp() now uses support.threading_setup() and + support.threading_cleanup() to wait until threads complete to avoid + random side effects on following tests. Initial patch written by Grzegorz + Grzywacz. - Refactor test_logging to use unittest. -- 2.50.0