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 <victor.stinner@gmail.com>
* 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 <victor.stinner@gmail.com>
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index b466138..2f9abe0 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -22,6 +22,7 @@
print arg
+
class BasicThreadTest(unittest.TestCase):
def setUp(self):
@@ -33,6 +34,9 @@
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 96cc90e..01bcd3b 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -507,6 +507,7 @@
Eric Groo
Dag Gruneau
Filip GruszczyĆski
+Grzegorz Grzywacz
Thomas Guettler
Anuj Gupta
Michael Guravage
diff --git a/Misc/NEWS b/Misc/NEWS
index 9b551dc..059f2b3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12109,6 +12109,10 @@
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.