Release SyncVito 1.0.15
This commit is contained in:
1 parent
1d0b1b2d38
commit
6c677f0161
9 files changed
+163
-10
No files matched your search
@@ -293,3 +293,55 @@ def test_concurrently_deleted_source_file_is_skipped(tmp_path: Path, monkeypatch
|
||||
assert result.skipped == 1
|
||||
assert not result.errors
|
||||
assert not (target / "ephemeral.txt").exists()
|
||||
|
||||
|
||||
def test_ignored_paths_are_completely_skipped(tmp_path: Path) -> None:
|
||||
source = tmp_path / "source"
|
||||
target = tmp_path / "target"
|
||||
source.mkdir()
|
||||
target.mkdir()
|
||||
(source / "normal.txt").write_text("kopieren", encoding="utf-8")
|
||||
(source / "locked.db").write_text("gesperrt", encoding="utf-8")
|
||||
(source / "subdir").mkdir()
|
||||
(source / "subdir" / "ignored_file.txt").write_text("in ordner", encoding="utf-8")
|
||||
|
||||
task = SyncTask(
|
||||
name="IgnoredTest",
|
||||
source=str(source),
|
||||
target=str(target),
|
||||
ignored_paths=["locked.db", "subdir/ignored_file.txt"],
|
||||
)
|
||||
engine = _engine(tmp_path)
|
||||
result = engine.synchronize(task)
|
||||
|
||||
assert result.successful
|
||||
assert result.copied == 1
|
||||
assert (target / "normal.txt").exists()
|
||||
assert not (target / "locked.db").exists()
|
||||
assert not (target / "subdir" / "ignored_file.txt").exists()
|
||||
|
||||
|
||||
def test_failed_files_added_to_failed_relatives(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
source = tmp_path / "source"
|
||||
target = tmp_path / "target"
|
||||
source.mkdir()
|
||||
target.mkdir()
|
||||
(source / "ok.txt").write_text("ok", encoding="utf-8")
|
||||
(source / "fail.txt").write_text("fail", encoding="utf-8")
|
||||
task = SyncTask(name="FailTest", source=str(source), target=str(target))
|
||||
engine = _engine(tmp_path)
|
||||
|
||||
real_execute = SyncEngine._execute
|
||||
|
||||
def mock_execute(operation, result):
|
||||
if operation.relative == "fail.txt":
|
||||
raise PermissionError("Access denied")
|
||||
return real_execute(operation, result)
|
||||
|
||||
monkeypatch.setattr(engine, "_execute", mock_execute)
|
||||
result = engine.synchronize(task)
|
||||
|
||||
assert not result.successful
|
||||
assert "fail.txt" in result.failed_relatives
|
||||
assert "ok.txt" not in result.failed_relatives
|
||||
assert (target / "ok.txt").exists()
|
||||
Reference in new issue
Block a user