@@ -391,3 +391,29 @@ def test_interrupt_during_pdb_set_trace():
391391 validate_message (reply , 'execute_reply' , msg_id )
392392 reply = kc .get_shell_msg (timeout = TIMEOUT )
393393 validate_message (reply , 'execute_reply' , msg_id2 )
394+
395+ def test_abort_execute_requests ():
396+ """test that execute_request's are aborted after an error"""
397+ with kernel () as kc :
398+ msg_id1 = kc .execute (code = "assert False" )
399+ msg_id2 = kc .execute (code = "assert True" )
400+ reply1 = kc .get_shell_msg (timeout = TIMEOUT )
401+ reply2 = kc .get_shell_msg (timeout = TIMEOUT )
402+ assert reply1 ['content' ]['status' ] == 'error'
403+ assert reply2 ['content' ]['status' ] == 'aborted'
404+
405+ def test_dont_abort_non_execute_requests ():
406+ """test that kernel_info, comm_info and inspect requests are not aborted after an error"""
407+ with kernel () as kc :
408+ msg_id1 = kc .execute (code = "assert False" )
409+ msg_id2 = kc .kernel_info ()
410+ msg_id3 = kc .comm_info ()
411+ msg_id4 = kc .inspect (code = "pri" )
412+ reply1 = kc .get_shell_msg (timeout = TIMEOUT ) # execute
413+ reply2 = kc .get_shell_msg (timeout = TIMEOUT ) # kernel_info
414+ reply3 = kc .get_shell_msg (timeout = TIMEOUT ) # comm_info
415+ reply4 = kc .get_shell_msg (timeout = TIMEOUT ) # inspect
416+ assert reply1 ['content' ]['status' ] == 'error'
417+ assert reply2 ['content' ]['status' ] == 'ok'
418+ assert reply3 ['content' ]['status' ] == 'ok'
419+ assert reply4 ['content' ]['status' ] == 'ok'
0 commit comments