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

Function test_refs_delete

test/test_refs.py:161–182  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

159
160
161def test_refs_delete(testrepo: Repository) -> None:
162 # We add a tag as a new reference that points to "origin/master"
163 reference = testrepo.references.create('refs/tags/version1', LAST_COMMIT)
164 assert 'refs/tags/version1' in testrepo.references
165
166 # And we delete it
167 reference.delete()
168 assert 'refs/tags/version1' not in testrepo.references
169
170 # Access the deleted reference
171 with pytest.raises(GitError):
172 getattr(reference, 'name')
173 with pytest.raises(GitError):
174 getattr(reference, 'type')
175 with pytest.raises(GitError):
176 getattr(reference, 'target')
177 with pytest.raises(GitError):
178 reference.delete()
179 with pytest.raises(GitError):
180 reference.resolve()
181 with pytest.raises(GitError):
182 reference.rename('refs/tags/version2')
183
184
185def test_refs_rename(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 3

createMethod · 0.45
deleteMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…