File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -4201,6 +4201,20 @@ def test_pidfd_open_notification_without_immediate_reap(self):
42014201 def test_kqueue_notification_without_immediate_reap (self ):
42024202 self .assert_notification_without_immediate_reap ("_wait_kqueue" )
42034203
4204+ @unittest .skipUnless (
4205+ CAN_USE_PIDFD_OPEN or CAN_USE_KQUEUE ,
4206+ "fast wait mechanism not available"
4207+ )
4208+ def test_fast_path_avoid_busy_loop (self ):
4209+ # assert that the busy loop is not called as long as the fast
4210+ # wait is available
4211+ with mock .patch ('time.sleep' ) as m :
4212+ p = subprocess .Popen ([sys .executable ,
4213+ "-c" , "import time; time.sleep(0.3)" ])
4214+ with self .assertRaises (subprocess .TimeoutExpired ):
4215+ p .wait (timeout = 0.0001 )
4216+ self .assertEqual (p .wait (timeout = support .LONG_TIMEOUT ), 0 )
4217+ assert not m .called
42044218
42054219if __name__ == "__main__" :
42064220 unittest .main ()
You can’t perform that action at this time.
0 commit comments