@@ -559,22 +559,22 @@ async def test_notebooks_error_cases(mcp_client_parametrized: MCPClient):
559559
560560
561561###############################################################################
562- # execute_ipython Tests
562+ # execute_code Tests
563563###############################################################################
564564
565565@pytest .mark .asyncio
566566@timeout_wrapper (30 )
567- async def test_execute_ipython_python_code (mcp_client_parametrized : MCPClient ):
568- """Test execute_ipython with basic Python code in both modes"""
567+ async def test_execute_code_python_code (mcp_client_parametrized : MCPClient ):
568+ """Test execute_code with basic Python code in both modes"""
569569 async with mcp_client_parametrized :
570570 # Test simple Python code
571- result = await mcp_client_parametrized .execute_ipython ("print('Hello IPython World!')" )
571+ result = await mcp_client_parametrized .execute_code ("print('Hello IPython World!')" )
572572
573573 # On Windows, if result is None it's likely due to timeout - skip the test
574574 if platform .system () == "Windows" and result is None :
575- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
575+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
576576
577- assert result is not None , "execute_ipython result should not be None"
577+ assert result is not None , "execute_code result should not be None"
578578 assert "result" in result , "Result should contain 'result' key"
579579 outputs = result ["result" ]
580580 assert isinstance (outputs , list ), "Outputs should be a list"
@@ -584,10 +584,10 @@ async def test_execute_ipython_python_code(mcp_client_parametrized: MCPClient):
584584 assert "Hello IPython World!" in output_text or "[No output generated]" in output_text
585585
586586 # Test mathematical calculation
587- calc_result = await mcp_client_parametrized .execute_ipython ("result = 2 ** 10\n print(f'2^10 = {result}')" )
587+ calc_result = await mcp_client_parametrized .execute_code ("result = 2 ** 10\n print(f'2^10 = {result}')" )
588588
589589 if platform .system () == "Windows" and calc_result is None :
590- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
590+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
591591
592592 assert calc_result is not None
593593 calc_outputs = calc_result ["result" ]
@@ -597,38 +597,38 @@ async def test_execute_ipython_python_code(mcp_client_parametrized: MCPClient):
597597
598598@pytest .mark .asyncio
599599@timeout_wrapper (30 )
600- async def test_execute_ipython_magic_commands (mcp_client_parametrized : MCPClient ):
601- """Test execute_ipython with IPython magic commands in both modes"""
600+ async def test_execute_code_magic_commands (mcp_client_parametrized : MCPClient ):
601+ """Test execute_code with IPython magic commands in both modes"""
602602 async with mcp_client_parametrized :
603603 # Test %who magic command (list variables)
604- result = await mcp_client_parametrized .execute_ipython ("%who" )
604+ result = await mcp_client_parametrized .execute_code ("%who" )
605605
606606 # On Windows, if result is None it's likely due to timeout - skip the test
607607 if platform .system () == "Windows" and result is None :
608- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
608+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
609609
610- assert result is not None , "execute_ipython result should not be None"
610+ assert result is not None , "execute_code result should not be None"
611611 outputs = result ["result" ]
612612 assert isinstance (outputs , list ), "Outputs should be a list"
613613
614614 # Set a variable first, then use %who to see it
615- var_result = await mcp_client_parametrized .execute_ipython ("test_var = 42" )
615+ var_result = await mcp_client_parametrized .execute_code ("test_var = 42" )
616616 if platform .system () == "Windows" and var_result is None :
617- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
617+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
618618
619- who_result = await mcp_client_parametrized .execute_ipython ("%who" )
619+ who_result = await mcp_client_parametrized .execute_code ("%who" )
620620 if platform .system () == "Windows" and who_result is None :
621- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
621+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
622622
623623 who_outputs = who_result ["result" ]
624624 who_text = "" .join (str (output ) for output in who_outputs )
625625 # %who should show our variable (or no output if variables exist but aren't shown)
626626 # This test mainly ensures %who doesn't crash
627627
628628 # Test %timeit magic command
629- timeit_result = await mcp_client_parametrized .execute_ipython ("%timeit sum(range(100))" )
629+ timeit_result = await mcp_client_parametrized .execute_code ("%timeit sum(range(100))" )
630630 if platform .system () == "Windows" and timeit_result is None :
631- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
631+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
632632
633633 assert timeit_result is not None
634634 timeit_outputs = timeit_result ["result" ]
@@ -639,17 +639,17 @@ async def test_execute_ipython_magic_commands(mcp_client_parametrized: MCPClient
639639
640640@pytest .mark .asyncio
641641@timeout_wrapper (30 )
642- async def test_execute_ipython_shell_commands (mcp_client_parametrized : MCPClient ):
643- """Test execute_ipython with shell commands in both modes"""
642+ async def test_execute_code_shell_commands (mcp_client_parametrized : MCPClient ):
643+ """Test execute_code with shell commands in both modes"""
644644 async with mcp_client_parametrized :
645645 # Test basic shell command - echo (works on most systems)
646- result = await mcp_client_parametrized .execute_ipython ("!echo 'Hello from shell'" )
646+ result = await mcp_client_parametrized .execute_code ("!echo 'Hello from shell'" )
647647
648648 # On Windows, if result is None it's likely due to timeout - skip the test
649649 if platform .system () == "Windows" and result is None :
650- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
650+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
651651
652- assert result is not None , "execute_ipython result should not be None"
652+ assert result is not None , "execute_code result should not be None"
653653 outputs = result ["result" ]
654654 assert isinstance (outputs , list ), "Outputs should be a list"
655655
@@ -658,9 +658,9 @@ async def test_execute_ipython_shell_commands(mcp_client_parametrized: MCPClient
658658 assert len (output_text ) >= 0 # Just ensure no crash
659659
660660 # Test Python version check
661- python_result = await mcp_client_parametrized .execute_ipython ("!python --version" )
661+ python_result = await mcp_client_parametrized .execute_code ("!python --version" )
662662 if platform .system () == "Windows" and python_result is None :
663- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
663+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
664664
665665 assert python_result is not None
666666 python_outputs = python_result ["result" ]
@@ -671,15 +671,15 @@ async def test_execute_ipython_shell_commands(mcp_client_parametrized: MCPClient
671671
672672@pytest .mark .asyncio
673673@timeout_wrapper (30 )
674- async def test_execute_ipython_timeout (mcp_client_parametrized : MCPClient ):
675- """Test execute_ipython timeout functionality in both modes"""
674+ async def test_execute_code_timeout (mcp_client_parametrized : MCPClient ):
675+ """Test execute_code timeout functionality in both modes"""
676676 async with mcp_client_parametrized :
677677 # Test with very short timeout on a potentially long-running command
678- result = await mcp_client_parametrized .execute_ipython ("import time; time.sleep(5)" , timeout = 2 )
678+ result = await mcp_client_parametrized .execute_code ("import time; time.sleep(5)" , timeout = 2 )
679679
680680 # On Windows, if result is None it's likely due to timeout - skip the test
681681 if platform .system () == "Windows" and result is None :
682- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
682+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
683683
684684 assert result is not None
685685 outputs = result ["result" ]
@@ -690,15 +690,15 @@ async def test_execute_ipython_timeout(mcp_client_parametrized: MCPClient):
690690
691691@pytest .mark .asyncio
692692@timeout_wrapper (30 )
693- async def test_execute_ipython_error_handling (mcp_client_parametrized : MCPClient ):
694- """Test execute_ipython error handling in both modes"""
693+ async def test_execute_code_error_handling (mcp_client_parametrized : MCPClient ):
694+ """Test execute_code error handling in both modes"""
695695 async with mcp_client_parametrized :
696696 # Test syntax error
697- result = await mcp_client_parametrized .execute_ipython ("invalid python syntax <<<" )
697+ result = await mcp_client_parametrized .execute_code ("invalid python syntax <<<" )
698698
699699 # On Windows, if result is None it's likely due to timeout - skip the test
700700 if platform .system () == "Windows" and result is None :
701- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
701+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
702702
703703 assert result is not None
704704 outputs = result ["result" ]
@@ -707,9 +707,9 @@ async def test_execute_ipython_error_handling(mcp_client_parametrized: MCPClient
707707 assert len (output_text ) >= 0 # Ensure no crash
708708
709709 # Test runtime error
710- runtime_result = await mcp_client_parametrized .execute_ipython ("undefined_variable" )
710+ runtime_result = await mcp_client_parametrized .execute_code ("undefined_variable" )
711711 if platform .system () == "Windows" and runtime_result is None :
712- pytest .skip ("execute_ipython timed out on Windows - known platform limitation" )
712+ pytest .skip ("execute_code timed out on Windows - known platform limitation" )
713713
714714 assert runtime_result is not None
715715 runtime_outputs = runtime_result ["result" ]
0 commit comments