Collect original test methods from lib path before patching. Returns: - For file: set of (class_name, method_name) or None if file doesn't exist - For directory: dict mapping file path to set of methods, or None if dir doesn't exist
(
lib_path: pathlib.Path,
)
| 47 | |
| 48 | |
| 49 | def collect_original_methods( |
| 50 | lib_path: pathlib.Path, |
| 51 | ) -> set[tuple[str, str]] | dict[pathlib.Path, set[tuple[str, str]]] | None: |
| 52 | """ |
| 53 | Collect original test methods from lib path before patching. |
| 54 | |
| 55 | Returns: |
| 56 | - For file: set of (class_name, method_name) or None if file doesn't exist |
| 57 | - For directory: dict mapping file path to set of methods, or None if dir doesn't exist |
| 58 | """ |
| 59 | from update_lib.cmd_auto_mark import extract_test_methods |
| 60 | |
| 61 | if not lib_path.exists(): |
| 62 | return None |
| 63 | |
| 64 | if lib_path.is_file(): |
| 65 | content = safe_read_text(lib_path) |
| 66 | return extract_test_methods(content) if content else set() |
| 67 | else: |
| 68 | result = {} |
| 69 | for lib_file in get_test_files(lib_path): |
| 70 | content = safe_read_text(lib_file) |
| 71 | if content: |
| 72 | result[lib_file.resolve()] = extract_test_methods(content) |
| 73 | return result |
| 74 | |
| 75 | |
| 76 | def quick( |