Normalize path separators to forward slashes for nodeid compatibility. Replaces backslashes with forward slashes. This handles both Windows native paths and cross-platform data (e.g., Windows paths in serialized test reports when running on Linux). :param path: A path string or Pat
(path: str | os.PathLike[str])
| 51 | |
| 52 | |
| 53 | def norm_sep(path: str | os.PathLike[str]) -> str: |
| 54 | """Normalize path separators to forward slashes for nodeid compatibility. |
| 55 | |
| 56 | Replaces backslashes with forward slashes. This handles both Windows native |
| 57 | paths and cross-platform data (e.g., Windows paths in serialized test reports |
| 58 | when running on Linux). |
| 59 | |
| 60 | :param path: A path string or PathLike object. |
| 61 | :returns: String with all backslashes replaced by forward slashes. |
| 62 | """ |
| 63 | return os.fspath(path).replace("\\", SEP) |
| 64 | |
| 65 | |
| 66 | tracebackcutdir = Path(_pytest.__file__).parent |