]> granicus.if.org Git - python/commitdiff
bpo-30357 each test in test_thread waits until all spawned threads finish (#1583)
authorgrzgrzgrz3 <grzgrzgrz3@gmail.com>
Mon, 15 May 2017 19:01:07 +0000 (21:01 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 15 May 2017 19:01:07 +0000 (21:01 +0200)
* 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>
Lib/test/test_thread.py
Misc/ACKS
Misc/NEWS

index b46613876137b3b70b7a5218bce4a41c030b0aca..2f9abe078fc2ea4ffb317616f53f15c943de1399 100644 (file)
@@ -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):
 
index 96cc90ed3644e5480a7ff6eaa6a89a100383e79c..01bcd3b834f162d5bd09ea2baf9525aaba39586c 100644 (file)
--- 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
index 9b551dca908059d73fc890eb145fe98ed708851b..059f2b3086021be4d3b0ca443c0aac211dd10b7b 100644 (file)
--- 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.