File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Lib/test/test_concurrent_futures Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,9 @@ def test_all_completed(self):
114114
115115 def test_timeout (self ):
116116 short_timeout = 0.050
117- long_timeout = short_timeout * 10
117+ event = threading . Event ()
118118
119- future = self .executor .submit (time . sleep , long_timeout )
119+ future = self .executor .submit (event . wait )
120120
121121 finished , pending = futures .wait (
122122 [CANCELLED_AND_NOTIFIED_FUTURE ,
@@ -126,6 +126,9 @@ def test_timeout(self):
126126 timeout = short_timeout ,
127127 return_when = futures .ALL_COMPLETED )
128128
129+ event .set ()
130+ futures .wait ([future ], return_when = futures .ALL_COMPLETED )
131+
129132 self .assertEqual (set ([CANCELLED_AND_NOTIFIED_FUTURE ,
130133 EXCEPTION_FUTURE ,
131134 SUCCESSFUL_FUTURE ]),
You can’t perform that action at this time.
0 commit comments