(operations: list[UpdateFile | DeleteFile])
| 448 | |
| 449 | |
| 450 | def perform_file_operations(operations: list[UpdateFile | DeleteFile]) -> None: |
| 451 | for op in operations: |
| 452 | if isinstance(op, UpdateFile): |
| 453 | # Modify/create file |
| 454 | write_and_fudge_mtime(op.content, op.target_path) |
| 455 | else: |
| 456 | # Delete file/directory |
| 457 | if os.path.isdir(op.path): |
| 458 | # Sanity check to avoid unexpected deletions |
| 459 | assert op.path.startswith("tmp") |
| 460 | shutil.rmtree(op.path) |
| 461 | else: |
| 462 | # Use retries to work around potential flakiness on Windows (AppVeyor). |
| 463 | path = op.path |
| 464 | retry_on_error(lambda: os.remove(path)) |
| 465 | |
| 466 | |
| 467 | def check_test_output_files( |
searching dependent graphs…