Skip to content

Commit 5221d9c

Browse files
authored
Revert "gh-128364: Fix flaky test_timeout test (gh-130724)" (gh-130732)
Change broke Android and iOS buildbots that do not have multiprocessing. This reverts commit cfa0b1d.
1 parent cfa0b1d commit 5221d9c

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

Lib/test/test_concurrent_futures/test_wait.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ def test_all_completed(self):
114114

115115
def test_timeout(self):
116116
short_timeout = 0.050
117+
long_timeout = short_timeout * 10
117118

118-
future = self.executor.submit(self.event.wait)
119+
future = self.executor.submit(time.sleep, long_timeout)
119120

120121
finished, pending = futures.wait(
121122
[CANCELLED_AND_NOTIFIED_FUTURE,
@@ -131,9 +132,6 @@ def test_timeout(self):
131132
finished)
132133
self.assertEqual(set([future]), pending)
133134

134-
# Set the event to allow the future to complete
135-
self.event.set()
136-
137135

138136
class ThreadPoolWaitTests(ThreadPoolMixin, WaitTests, BaseTestCase):
139137

Lib/test/test_concurrent_futures/util.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import multiprocessing
22
import sys
3-
import threading
43
import time
54
import unittest
65
from concurrent import futures
@@ -47,24 +46,18 @@ def setUp(self):
4746

4847
self.t1 = time.monotonic()
4948
if hasattr(self, "ctx"):
50-
self.manager = multiprocessing.Manager()
51-
self.event = self.manager.Event()
5249
self.executor = self.executor_type(
5350
max_workers=self.worker_count,
5451
mp_context=self.get_context(),
5552
**self.executor_kwargs)
5653
else:
57-
self.event = threading.Event()
5854
self.executor = self.executor_type(
5955
max_workers=self.worker_count,
6056
**self.executor_kwargs)
6157

6258
def tearDown(self):
6359
self.executor.shutdown(wait=True)
6460
self.executor = None
65-
if hasattr(self, "ctx"):
66-
self.manager.shutdown()
67-
self.manager = None
6861

6962
dt = time.monotonic() - self.t1
7063
if support.verbose:

0 commit comments

Comments
 (0)