MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_applies_error

Function test_applies_error

test/test_apply_diff.py:169–182  ·  view source on GitHub ↗
(
    testrepo: Repository, old_content: str, patch_diff: Diff, foreign_patch_diff: Diff
)

Source from the content-addressed store, hash-verified

167
168
169def test_applies_error(
170 testrepo: Repository, old_content: str, patch_diff: Diff, foreign_patch_diff: Diff
171) -> None:
172 # Try to apply a "foreign" patch that affects files that aren't in the repo;
173 # ensure we get OSError about the missing file (due to raise_error)
174 with pytest.raises(OSError):
175 testrepo.applies(foreign_patch_diff, ApplyLocation.BOTH, raise_error=True)
176
177 # Apply a valid patch
178 testrepo.apply(patch_diff, ApplyLocation.BOTH)
179
180 # Ensure it can't be applied again and we get an exception about it (due to raise_error)
181 with pytest.raises(pygit2.GitError):
182 testrepo.applies(patch_diff, ApplyLocation.BOTH, raise_error=True)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…