def test_sync_no_target(self, source, tmp_path): """Test _sync_dirs utility function if target doesn't exist.""" target = Path(tmp_path) / "target" _sync_dirs(source, target) assert (source / "existing" / "source_file").is_file() assert (source / "existing" / "common").read_text() == "source" assert not (source / "existing" / "target_file").exists() assert (source / "new" / "source_file").is_file() assert (target / "existing" / "source_file").is_file() assert (target / "existing" / "common").read_text() == "source" assert not (target / "existing" / "target_file").exists() assert (target / "new" / "source_file").is_file()
def test_sync_target_exists(self, source, tmp_path): """Test _sync_dirs utility function if target exists.""" target = Path(tmp_path) / "target" target.mkdir() (target / "existing").mkdir() (target / "existing" / "target_file").touch() (target / "existing" / "common").write_text("target") _sync_dirs(source, target) assert (source / "existing" / "source_file").is_file() assert (source / "existing" / "common").read_text() == "source" assert not (source / "existing" / "target_file").exists() assert (source / "new" / "source_file").is_file() assert (target / "existing" / "source_file").is_file() assert (target / "existing" / "common").read_text() == "target" assert (target / "existing" / "target_file").exists() assert (target / "new" / "source_file").is_file()