Get all test module names from cpython/Lib/test/. Returns: Sorted list of test names (e.g., ["test_abc", "test_dis", ...])
(cpython_prefix: str)
| 134 | |
| 135 | |
| 136 | def get_all_tests(cpython_prefix: str) -> list[str]: |
| 137 | """Get all test module names from cpython/Lib/test/. |
| 138 | |
| 139 | Returns: |
| 140 | Sorted list of test names (e.g., ["test_abc", "test_dis", ...]) |
| 141 | """ |
| 142 | test_dir = pathlib.Path(cpython_prefix) / "Lib" / "test" |
| 143 | if not test_dir.exists(): |
| 144 | return [] |
| 145 | |
| 146 | tests = set() |
| 147 | for entry in test_dir.iterdir(): |
| 148 | # Skip non-test items |
| 149 | if "test" not in entry.name: |
| 150 | continue |
| 151 | |
| 152 | # Exclude special cases |
| 153 | if "regrtest" in entry.name: |
| 154 | continue |
| 155 | |
| 156 | if entry.is_file() and entry.suffix == ".py": |
| 157 | tests.add(entry.stem) |
| 158 | elif entry.is_dir() and (entry / "__init__.py").exists(): |
| 159 | tests.add(entry.name) |
| 160 | |
| 161 | return sorted(tests) |
| 162 | |
| 163 | |
| 164 | def get_untracked_files( |