Release SyncVito 1.0.12
This commit is contained in:
1 parent
ccb89191b5
commit
786e3ae9b3
8 files changed
+144
-8
No files matched your search
@@ -269,3 +269,27 @@ def test_pause_and_resume_continues_where_interrupted(tmp_path: Path) -> None:
|
||||
assert (target / "a.txt").exists()
|
||||
assert (target / "b.txt").exists()
|
||||
assert (target / "c.txt").exists()
|
||||
|
||||
|
||||
def test_concurrently_deleted_source_file_is_skipped(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
source = tmp_path / "source"
|
||||
target = tmp_path / "target"
|
||||
source.mkdir()
|
||||
target.mkdir()
|
||||
(source / "ephemeral.txt").write_text("wird gelöscht")
|
||||
task = SyncTask(name="Transient", source=str(source), target=str(target))
|
||||
engine = _engine(tmp_path)
|
||||
|
||||
# Simuliere, dass die Datei kurz vor der Ausführung gelöscht wurde
|
||||
def delete_before_execute(operation, result):
|
||||
if operation.source and operation.source.name == "ephemeral.txt":
|
||||
operation.source.unlink(missing_ok=True)
|
||||
return SyncEngine._execute(operation, result)
|
||||
|
||||
monkeypatch.setattr(engine, "_execute", delete_before_execute)
|
||||
result = engine.synchronize(task)
|
||||
|
||||
assert result.successful
|
||||
assert result.skipped == 1
|
||||
assert not result.errors
|
||||
assert not (target / "ephemeral.txt").exists()
|
||||
Reference in new issue
Block a user