File tree 2 files changed +2
-11
lines changed
Lib/test/test_concurrent_futures
2 files changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -114,8 +114,9 @@ def test_all_completed(self):
114
114
115
115
def test_timeout (self ):
116
116
short_timeout = 0.050
117
+ long_timeout = short_timeout * 10
117
118
118
- future = self .executor .submit (self . event . wait )
119
+ future = self .executor .submit (time . sleep , long_timeout )
119
120
120
121
finished , pending = futures .wait (
121
122
[CANCELLED_AND_NOTIFIED_FUTURE ,
@@ -131,9 +132,6 @@ def test_timeout(self):
131
132
finished )
132
133
self .assertEqual (set ([future ]), pending )
133
134
134
- # Set the event to allow the future to complete
135
- self .event .set ()
136
-
137
135
138
136
class ThreadPoolWaitTests (ThreadPoolMixin , WaitTests , BaseTestCase ):
139
137
Original file line number Diff line number Diff line change 1
1
import multiprocessing
2
2
import sys
3
- import threading
4
3
import time
5
4
import unittest
6
5
from concurrent import futures
@@ -47,24 +46,18 @@ def setUp(self):
47
46
48
47
self .t1 = time .monotonic ()
49
48
if hasattr (self , "ctx" ):
50
- self .manager = multiprocessing .Manager ()
51
- self .event = self .manager .Event ()
52
49
self .executor = self .executor_type (
53
50
max_workers = self .worker_count ,
54
51
mp_context = self .get_context (),
55
52
** self .executor_kwargs )
56
53
else :
57
- self .event = threading .Event ()
58
54
self .executor = self .executor_type (
59
55
max_workers = self .worker_count ,
60
56
** self .executor_kwargs )
61
57
62
58
def tearDown (self ):
63
59
self .executor .shutdown (wait = True )
64
60
self .executor = None
65
- if hasattr (self , "ctx" ):
66
- self .manager .shutdown ()
67
- self .manager = None
68
61
69
62
dt = time .monotonic () - self .t1
70
63
if support .verbose :
You can’t perform that action at this time.
0 commit comments