1515 HasTraits , TraitError , Bool , Unicode , Dict , Integer , List , Enum
1616)
1717
18- from .utils import TIMEOUT , start_global_kernel , flush_channels , execute
18+ from .utils import (TIMEOUT , start_global_kernel , flush_channels , execute ,
19+ get_reply , )
1920
2021#-----------------------------------------------------------------------------
2122# Globals
@@ -278,7 +279,7 @@ def test_execute():
278279 flush_channels ()
279280
280281 msg_id = KC .execute (code = 'x=1' )
281- reply = KC . get_shell_msg ( timeout = TIMEOUT )
282+ reply = get_reply ( KC , msg_id , TIMEOUT )
282283 validate_message (reply , 'execute_reply' , msg_id )
283284
284285
@@ -405,7 +406,7 @@ def test_oinfo():
405406 flush_channels ()
406407
407408 msg_id = KC .inspect ('a' )
408- reply = KC . get_shell_msg ( timeout = TIMEOUT )
409+ reply = get_reply ( KC , msg_id , TIMEOUT )
409410 validate_message (reply , 'inspect_reply' , msg_id )
410411
411412
@@ -415,7 +416,7 @@ def test_oinfo_found():
415416 msg_id , reply = execute (code = 'a=5' )
416417
417418 msg_id = KC .inspect ('a' )
418- reply = KC . get_shell_msg ( timeout = TIMEOUT )
419+ reply = get_reply ( KC , msg_id , TIMEOUT )
419420 validate_message (reply , 'inspect_reply' , msg_id )
420421 content = reply ['content' ]
421422 assert content ['found' ]
@@ -430,7 +431,7 @@ def test_oinfo_detail():
430431 msg_id , reply = execute (code = 'ip=get_ipython()' )
431432
432433 msg_id = KC .inspect ('ip.object_inspect' , cursor_pos = 10 , detail_level = 1 )
433- reply = KC . get_shell_msg ( timeout = TIMEOUT )
434+ reply = get_reply ( KC , msg_id , TIMEOUT )
434435 validate_message (reply , 'inspect_reply' , msg_id )
435436 content = reply ['content' ]
436437 assert content ['found' ]
@@ -443,7 +444,7 @@ def test_oinfo_not_found():
443444 flush_channels ()
444445
445446 msg_id = KC .inspect ('dne' )
446- reply = KC . get_shell_msg ( timeout = TIMEOUT )
447+ reply = get_reply ( KC , msg_id , TIMEOUT )
447448 validate_message (reply , 'inspect_reply' , msg_id )
448449 content = reply ['content' ]
449450 assert not content ['found' ]
@@ -455,7 +456,7 @@ def test_complete():
455456 msg_id , reply = execute (code = "alpha = albert = 5" )
456457
457458 msg_id = KC .complete ('al' , 2 )
458- reply = KC . get_shell_msg ( timeout = TIMEOUT )
459+ reply = get_reply ( KC , msg_id , TIMEOUT )
459460 validate_message (reply , 'complete_reply' , msg_id )
460461 matches = reply ['content' ]['matches' ]
461462 for name in ('alpha' , 'albert' ):
@@ -466,7 +467,7 @@ def test_kernel_info_request():
466467 flush_channels ()
467468
468469 msg_id = KC .kernel_info ()
469- reply = KC . get_shell_msg ( timeout = TIMEOUT )
470+ reply = get_reply ( KC , msg_id , TIMEOUT )
470471 validate_message (reply , 'kernel_info_reply' , msg_id )
471472
472473
@@ -477,7 +478,7 @@ def test_connect_request():
477478 return msg ['header' ]['msg_id' ]
478479
479480 msg_id = KC .kernel_info ()
480- reply = KC . get_shell_msg ( timeout = TIMEOUT )
481+ reply = get_reply ( KC , msg_id , TIMEOUT )
481482 validate_message (reply , 'connect_reply' , msg_id )
482483
483484
@@ -486,7 +487,7 @@ def test_comm_info_request():
486487 if not hasattr (KC , 'comm_info' ):
487488 raise SkipTest ()
488489 msg_id = KC .comm_info ()
489- reply = KC . get_shell_msg ( timeout = TIMEOUT )
490+ reply = get_reply ( KC , msg_id , TIMEOUT )
490491 validate_message (reply , 'comm_info_reply' , msg_id )
491492
492493
@@ -512,7 +513,7 @@ def test_is_complete():
512513 flush_channels ()
513514
514515 msg_id = KC .is_complete ("a = 1" )
515- reply = KC . get_shell_msg ( timeout = TIMEOUT )
516+ reply = get_reply ( KC , msg_id , TIMEOUT )
516517 validate_message (reply , 'is_complete_reply' , msg_id )
517518
518519def test_history_range ():
@@ -522,7 +523,7 @@ def test_history_range():
522523 reply_exec = KC .get_shell_msg (timeout = TIMEOUT )
523524
524525 msg_id = KC .history (hist_access_type = 'range' , raw = True , output = True , start = 1 , stop = 2 , session = 0 )
525- reply = KC . get_shell_msg ( timeout = TIMEOUT )
526+ reply = get_reply ( KC , msg_id , TIMEOUT )
526527 validate_message (reply , 'history_reply' , msg_id )
527528 content = reply ['content' ]
528529 assert len (content ['history' ]) == 1
@@ -534,7 +535,7 @@ def test_history_tail():
534535 reply_exec = KC .get_shell_msg (timeout = TIMEOUT )
535536
536537 msg_id = KC .history (hist_access_type = 'tail' , raw = True , output = True , n = 1 , session = 0 )
537- reply = KC . get_shell_msg ( timeout = TIMEOUT )
538+ reply = get_reply ( KC , msg_id , TIMEOUT )
538539 validate_message (reply , 'history_reply' , msg_id )
539540 content = reply ['content' ]
540541 assert len (content ['history' ]) == 1
@@ -546,7 +547,7 @@ def test_history_search():
546547 reply_exec = KC .get_shell_msg (timeout = TIMEOUT )
547548
548549 msg_id = KC .history (hist_access_type = 'search' , raw = True , output = True , n = 1 , pattern = '*' , session = 0 )
549- reply = KC . get_shell_msg ( timeout = TIMEOUT )
550+ reply = get_reply ( KC , msg_id , TIMEOUT )
550551 validate_message (reply , 'history_reply' , msg_id )
551552 content = reply ['content' ]
552553 assert len (content ['history' ]) == 1
0 commit comments