|
18 | 18 | import pytest |
19 | 19 | from pytest import MonkeyPatch |
20 | 20 |
|
21 | | -import nemo_curator.backends.failed_task_markers as failed_task_markers_module |
22 | 21 | from nemo_curator.backends.failed_task_markers import ( |
23 | 22 | FAILED_TASK_MANIFEST_FILENAME, |
24 | 23 | FAILED_TASKS_DIR_ENV_VAR, |
@@ -87,7 +86,6 @@ def test_record_failed_tasks_writes_single_manifest( |
87 | 86 |
|
88 | 87 | manifest_files = list(manifest_dir.glob("*.json")) |
89 | 88 | assert manifest_files == [manifest_dir / FAILED_TASK_MANIFEST_FILENAME] |
90 | | - assert manifest_files[0].read_text() == '{"status":"failed_tasks"}\n' |
91 | 89 | assert failed_task_manifest_exists() |
92 | 90 |
|
93 | 91 | def test_additional_failed_tasks_leave_existing_manifest_unchanged( |
@@ -131,11 +129,11 @@ def test_record_failed_tasks_propagates_manifest_write_failure( |
131 | 129 | manifest_dir = tmp_path / "failed-tasks" |
132 | 130 | monkeypatch.setenv(FAILED_TASKS_DIR_ENV_VAR, str(manifest_dir)) |
133 | 131 |
|
134 | | - def fail_write(*_args: object, **_kwargs: object) -> None: |
| 132 | + def fail_touch(self: Path, mode: int = 0o666, exist_ok: bool = True) -> None: |
135 | 133 | msg = "storage unavailable" |
136 | 134 | raise OSError(msg) |
137 | 135 |
|
138 | | - monkeypatch.setattr(failed_task_markers_module, "write_json_atomically", fail_write) |
| 136 | + monkeypatch.setattr(Path, "touch", fail_touch) |
139 | 137 |
|
140 | 138 | with pytest.raises(OSError, match="storage unavailable"): |
141 | 139 | record_failed_tasks([_failed_task()]) |
|
0 commit comments