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

Function get_test_module_name

scripts/update_lib/file_utils.py:131–142  ·  view source on GitHub ↗

Extract test module name from a test file path. Examples: Lib/test/test_foo.py -> test_foo Lib/test/test_ctypes/test_bar.py -> test_ctypes.test_bar

(test_path: pathlib.Path)

Source from the content-addressed store, hash-verified

129
130
131def get_test_module_name(test_path: pathlib.Path) -> str:
132 """
133 Extract test module name from a test file path.
134
135 Examples:
136 Lib/test/test_foo.py -> test_foo
137 Lib/test/test_ctypes/test_bar.py -> test_ctypes.test_bar
138 """
139 test_path = pathlib.Path(test_path)
140 if test_path.parent.name.startswith("test_"):
141 return f"{test_path.parent.name}.{test_path.stem}"
142 return test_path.stem
143
144
145def resolve_module_path(

Callers 5

auto_mark_fileFunction · 0.90
auto_mark_directoryFunction · 0.90
test_simple_test_fileMethod · 0.90
test_nested_test_fileMethod · 0.90
test_test_directoryMethod · 0.90

Calls 1

startswithMethod · 0.45

Tested by 3

test_simple_test_fileMethod · 0.72
test_nested_test_fileMethod · 0.72
test_test_directoryMethod · 0.72