MCPcopy Index your code
hub / github.com/ipython/ipython / create_test_modules

Function create_test_modules

tests/test_debugger.py:741–850  ·  view source on GitHub ↗

Create a comprehensive module hierarchy for testing all debugger commands.

(temp_dir)

Source from the content-addressed store, hash-verified

739
740# Helper function for creating temporary modules
741def create_test_modules(temp_dir):
742 """Create a comprehensive module hierarchy for testing all debugger commands."""
743
744 temp_path = Path(temp_dir)
745
746 # Create package structure for wildcard testing
747 package_dir = temp_path / "testpkg"
748 package_dir.mkdir()
749
750 # Package __init__.py
751 (package_dir / "__init__.py").write_text("# Test package")
752
753 # testpkg/submod1.py
754 (package_dir / "submod1.py").write_text(
755 dedent(
756 """
757 def submod1_func():
758 x = 1
759 y = 2
760 return x + y
761 """
762 )
763 )
764
765 # testpkg/submod2.py
766 (package_dir / "submod2.py").write_text(
767 dedent(
768 """
769 def submod2_func():
770 z = 10
771 return z * 2
772 """
773 )
774 )
775
776 # Level 1 (top level module)
777 (temp_path / "level1_module.py").write_text(
778 dedent(
779 """
780 from level2_module import level2_func
781
782 def level1_func():
783 return level2_func()
784 """
785 )
786 )
787
788 # Level 2 (middle level module)
789 (temp_path / "level2_module.py").write_text(
790 dedent(
791 """
792 from level3_module import level3_func
793 from testpkg.submod1 import submod1_func
794 from testpkg.submod2 import submod2_func
795
796 def level2_func():
797 # Call package functions for step/next testing
798 result1 = submod1_func()

Calls 1

dedentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…