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

Function _build_test_to_lib_map

scripts/update_lib/cmd_todo.py:273–303  ·  view source on GitHub ↗

Build reverse mapping from test name to library name using DEPENDENCIES. Returns: Tuple of: - Dict mapping test_name -> lib_name (e.g., "test_htmlparser" -> "html") - Dict mapping lib_name -> ordered list of test_names

(
    cpython_prefix: str,
)

Source from the content-addressed store, hash-verified

271
272
273def _build_test_to_lib_map(
274 cpython_prefix: str,
275) -> tuple[dict[str, str], dict[str, list[str]]]:
276 """Build reverse mapping from test name to library name using DEPENDENCIES.
277
278 Returns:
279 Tuple of:
280 - Dict mapping test_name -> lib_name (e.g., "test_htmlparser" -> "html")
281 - Dict mapping lib_name -> ordered list of test_names
282 """
283 import pathlib
284
285 from update_lib.deps import DEPENDENCIES
286
287 test_to_lib = {}
288 lib_test_order: dict[str, list[str]] = {}
289 for lib_name, dep_info in DEPENDENCIES.items():
290 if "test" not in dep_info:
291 continue
292 lib_test_order[lib_name] = []
293 for test_path in dep_info["test"]:
294 # test_path is like "test_htmlparser.py" or "test_multiprocessing_fork"
295 path = pathlib.Path(test_path)
296 if path.suffix == ".py":
297 test_name = path.stem
298 else:
299 test_name = path.name
300 test_to_lib[test_name] = lib_name
301 lib_test_order[lib_name].append(test_name)
302
303 return test_to_lib, lib_test_order
304
305
306def compute_test_todo_list(

Callers 1

compute_test_todo_listFunction · 0.85

Calls 2

itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected