From aeb644714d37fb974e3acdf7daef031461e1283f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 16 May 2017 17:05:29 -0700 Subject: [PATCH] bpo-30357: test_thread now uses threading_cleanup() (#1592) (#1623) 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: Grzegorz Grzywacz (cherry picked from commit 79ef7f8e88a4972c4aecf95cfc5cd934f1861e08) --- Lib/test/test_thread.py | 4 ++++ Misc/ACKS | 1 + Misc/NEWS | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py index ef3059b686..3909b75ccd 100644 --- a/Lib/test/test_thread.py +++ b/Lib/test/test_thread.py @@ -20,6 +20,7 @@ def verbose_print(arg): with _print_mutex: print(arg) + class BasicThreadTest(unittest.TestCase): def setUp(self): @@ -31,6 +32,9 @@ class BasicThreadTest(unittest.TestCase): self.running = 0 self.next_ident = 0 + key = support.threading_setup() + self.addCleanup(support.threading_cleanup, *key) + class ThreadRunningTests(BasicThreadTest): diff --git a/Misc/ACKS b/Misc/ACKS index 2d2436c9c3..3d9414b6b7 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -543,6 +543,7 @@ Eric Groo Daniel Andrade Groppe Dag Gruneau Filip Gruszczyński +Grzegorz Grzywacz Thomas Guettler Yuyang Guo Anuj Gupta diff --git a/Misc/NEWS b/Misc/NEWS index 16cb60c9e3..9386cb4b33 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -235,6 +235,11 @@ Build 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. + - bpo-28087: Skip test_asyncore and test_eintr poll failures on macOS. Skip some tests of select.poll when running on macOS due to unresolved issues with the underlying system poll function on some macOS versions. -- 2.50.1