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

Function collect_test_changes

scripts/update_lib/cmd_auto_mark.py:548–586  ·  view source on GitHub ↗

Collect failing tests and unexpected successes from test results. Args: results: TestResult from run_test() module_prefix: If set, only collect tests whose path starts with this prefix Returns: (failing_tests, unexpected_successes, error_messages) - fai

(
    results: TestResult,
    module_prefix: str | None = None,
)

Source from the content-addressed store, hash-verified

546
547
548def collect_test_changes(
549 results: TestResult,
550 module_prefix: str | None = None,
551) -> tuple[set[tuple[str, str]], set[tuple[str, str]], dict[tuple[str, str], str]]:
552 """
553 Collect failing tests and unexpected successes from test results.
554
555 Args:
556 results: TestResult from run_test()
557 module_prefix: If set, only collect tests whose path starts with this prefix
558
559 Returns:
560 (failing_tests, unexpected_successes, error_messages)
561 - failing_tests: set of (class_name, method_name) tuples
562 - unexpected_successes: set of (class_name, method_name) tuples
563 - error_messages: dict mapping (class_name, method_name) to error message
564 """
565 failing_tests = set()
566 error_messages: dict[tuple[str, str], str] = {}
567 for test in results.tests:
568 if test.result in ("fail", "error"):
569 if module_prefix and not test.path.startswith(module_prefix):
570 continue
571 test_parts = path_to_test_parts(test.path)
572 if len(test_parts) == 2:
573 key = tuple(test_parts)
574 failing_tests.add(key)
575 if test.error_message:
576 error_messages[key] = test.error_message
577
578 unexpected_successes = set()
579 for test in results.unexpected_successes:
580 if module_prefix and not test.path.startswith(module_prefix):
581 continue
582 test_parts = path_to_test_parts(test.path)
583 if len(test_parts) == 2:
584 unexpected_successes.add(tuple(test_parts))
585
586 return failing_tests, unexpected_successes, error_messages
587
588
589def apply_test_changes(

Calls 5

setFunction · 0.85
path_to_test_partsFunction · 0.85
lenFunction · 0.85
startswithMethod · 0.45
addMethod · 0.45