Helper to create the current symlink. It's full of race conditions that are reasonably OK to ignore for the context of best effort linking to the latest test run. The presumption being that in case of much parallelism the inaccuracy is going to be acceptable.
(root: Path, target: str | PurePath, link_to: str | Path)
| 202 | |
| 203 | |
| 204 | def _force_symlink(root: Path, target: str | PurePath, link_to: str | Path) -> None: |
| 205 | """Helper to create the current symlink. |
| 206 | |
| 207 | It's full of race conditions that are reasonably OK to ignore |
| 208 | for the context of best effort linking to the latest test run. |
| 209 | |
| 210 | The presumption being that in case of much parallelism |
| 211 | the inaccuracy is going to be acceptable. |
| 212 | """ |
| 213 | current_symlink = root.joinpath(target) |
| 214 | try: |
| 215 | current_symlink.unlink() |
| 216 | except OSError: |
| 217 | pass |
| 218 | try: |
| 219 | current_symlink.symlink_to(link_to) |
| 220 | except Exception: |
| 221 | pass |
| 222 | |
| 223 | |
| 224 | def make_numbered_dir(root: Path, prefix: str, mode: int = 0o700) -> Path: |