Skip to content

Commit 8e5e942

Browse files
committed
Use shorter timings in test_concurrent_futures to make it a bit faster
(it's still very slow)
1 parent 608aba3 commit 8e5e942

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Lib/test/test_concurrent_futures.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_del_shutdown(self):
155155
class WaitTests(unittest.TestCase):
156156
def test_first_completed(self):
157157
future1 = self.executor.submit(mul, 21, 2)
158-
future2 = self.executor.submit(time.sleep, 5)
158+
future2 = self.executor.submit(time.sleep, 1.5)
159159

160160
done, not_done = futures.wait(
161161
[CANCELLED_FUTURE, future1, future2],
@@ -165,7 +165,7 @@ def test_first_completed(self):
165165
self.assertEqual(set([CANCELLED_FUTURE, future2]), not_done)
166166

167167
def test_first_completed_some_already_completed(self):
168-
future1 = self.executor.submit(time.sleep, 2)
168+
future1 = self.executor.submit(time.sleep, 1.5)
169169

170170
finished, pending = futures.wait(
171171
[CANCELLED_AND_NOTIFIED_FUTURE, SUCCESSFUL_FUTURE, future1],
@@ -178,8 +178,8 @@ def test_first_completed_some_already_completed(self):
178178

179179
def test_first_exception(self):
180180
future1 = self.executor.submit(mul, 2, 21)
181-
future2 = self.executor.submit(sleep_and_raise, 5)
182-
future3 = self.executor.submit(time.sleep, 10)
181+
future2 = self.executor.submit(sleep_and_raise, 1.5)
182+
future3 = self.executor.submit(time.sleep, 3)
183183

184184
finished, pending = futures.wait(
185185
[future1, future2, future3],
@@ -190,7 +190,7 @@ def test_first_exception(self):
190190

191191
def test_first_exception_some_already_complete(self):
192192
future1 = self.executor.submit(divmod, 21, 0)
193-
future2 = self.executor.submit(time.sleep, 5)
193+
future2 = self.executor.submit(time.sleep, 1.5)
194194

195195
finished, pending = futures.wait(
196196
[SUCCESSFUL_FUTURE,
@@ -235,14 +235,14 @@ def test_all_completed(self):
235235

236236
def test_timeout(self):
237237
future1 = self.executor.submit(mul, 6, 7)
238-
future2 = self.executor.submit(time.sleep, 10)
238+
future2 = self.executor.submit(time.sleep, 3)
239239

240240
finished, pending = futures.wait(
241241
[CANCELLED_AND_NOTIFIED_FUTURE,
242242
EXCEPTION_FUTURE,
243243
SUCCESSFUL_FUTURE,
244244
future1, future2],
245-
timeout=5,
245+
timeout=1.5,
246246
return_when=futures.ALL_COMPLETED)
247247

248248
self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
@@ -332,8 +332,8 @@ def test_map_timeout(self):
332332
results = []
333333
try:
334334
for i in self.executor.map(time.sleep,
335-
[0, 0, 10],
336-
timeout=5):
335+
[0, 0, 3],
336+
timeout=1.5):
337337
results.append(i)
338338
except futures.TimeoutError:
339339
pass

0 commit comments

Comments
 (0)