Skip to content

Commit 6924ed5

Browse files
grzgrzgrz3vstinner
andcommitted
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 <[email protected]> * 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 <[email protected]>
1 parent 9d1983b commit 6924ed5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Lib/test/test_thread.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def verbose_print(arg):
2222
print arg
2323

2424

25+
2526
class BasicThreadTest(unittest.TestCase):
2627

2728
def setUp(self):
@@ -33,6 +34,9 @@ def setUp(self):
3334
self.running = 0
3435
self.next_ident = 0
3536

37+
key = test_support.threading_setup()
38+
self.addCleanup(test_support.threading_cleanup, *key)
39+
3640

3741
class ThreadRunningTests(BasicThreadTest):
3842

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ Fabian Groffen
507507
Eric Groo
508508
Dag Gruneau
509509
Filip Gruszczyński
510+
Grzegorz Grzywacz
510511
Thomas Guettler
511512
Anuj Gupta
512513
Michael Guravage

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12109,6 +12109,10 @@ IDLE
1210912109

1211012110
Tests
1211112111
-----
12112+
- bpo-30357: test_thread: setUp() now uses support.threading_setup() and
12113+
support.threading_cleanup() to wait until threads complete to avoid
12114+
random side effects on following tests. Initial patch written by Grzegorz
12115+
Grzywacz.
1211212116

1211312117
- Refactor test_logging to use unittest.
1211412118

0 commit comments

Comments
 (0)