MCPcopy Index your code
hub / github.com/RustPython/RustPython / resolve_test_to_lib

Function resolve_test_to_lib

scripts/update_lib/deps.py:773–794  ·  view source on GitHub ↗

Resolve a test name to its library group from DEPENDENCIES. Args: test_name: Test name with or without test_ prefix (e.g., "test_urllib2" or "urllib2") Returns: Library name if test belongs to a group, None otherwise

(test_name: str)

Source from the content-addressed store, hash-verified

771
772
773def resolve_test_to_lib(test_name: str) -> str | None:
774 """Resolve a test name to its library group from DEPENDENCIES.
775
776 Args:
777 test_name: Test name with or without test_ prefix (e.g., "test_urllib2" or "urllib2")
778
779 Returns:
780 Library name if test belongs to a group, None otherwise
781 """
782 # Normalize: add test_ prefix if not present
783 if not test_name.startswith("test_"):
784 test_name = f"test_{test_name}"
785
786 for lib_name, dep_info in DEPENDENCIES.items():
787 tests = dep_info.get("test", [])
788 for test_path in tests:
789 # test_path is like "test_urllib2.py" or "test_multiprocessing_fork"
790 path_stem = test_path.removesuffix(".py")
791 if path_stem == test_name:
792 return lib_name
793
794 return None
795
796
797# Test-specific dependencies (only when auto-detection isn't enough)

Callers 1

_resolve_module_nameFunction · 0.90

Calls 4

startswithMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45
removesuffixMethod · 0.45

Tested by

no test coverage detected