fix: protect editor saves and clear failed restored tab state
This commit is contained in:
@@ -76,12 +76,9 @@ def test_failed_atomic_save_keeps_original_and_history(tmp_path, monkeypatch):
|
||||
from mdhelper import file_versions
|
||||
path = tmp_path / "note.md"; path.write_bytes(b"original\r\n")
|
||||
store = VersionStore(tmp_path / "history")
|
||||
replace = file_versions.os.replace
|
||||
def failure(source, destination):
|
||||
if Path(destination) == path:
|
||||
raise OSError("simulated sharing violation")
|
||||
replace(source, destination)
|
||||
monkeypatch.setattr(file_versions.os, "replace", failure)
|
||||
def failure(source, destination, backup):
|
||||
raise OSError("simulated sharing violation")
|
||||
monkeypatch.setattr(file_versions, "_replace_with_backup", failure)
|
||||
with pytest.raises(OSError):
|
||||
store.save(path, "changed")
|
||||
assert path.read_bytes() == b"original\r\n"
|
||||
|
||||
Reference in New Issue
Block a user