fix: retain conflicting saves and preserve list content in Word

This commit is contained in:
2026-11-05 11:57:06 +08:00
parent e605c2f8d3
commit b3a0907e1a
11 changed files with 283 additions and 27 deletions
+2 -2
View File
@@ -53,9 +53,9 @@ def test_publication_cancellation_race_and_rollback(tmp_path, monkeypatch):
with pytest.raises(OSError, match='发生变化'): publish_outputs(outputs, expected, tmp_path)
destinations[0].write_bytes(b'old')
real_write = batch_documents.atomic_write
def fail(path, data):
def fail(path, data, **kwargs):
if path == destinations[1] and data == b'new': raise OSError('disk full')
real_write(path, data)
real_write(path, data, **kwargs)
monkeypatch.setattr(batch_documents, 'atomic_write', fail)
with pytest.raises(OSError, match='disk full'): publish_outputs(outputs, expected, tmp_path)
assert all(path.read_bytes() == b'old' for path in destinations)