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)
| 129 | |
| 130 | |
| 131 | def 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 | |
| 145 | def resolve_module_path( |