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

Function test_transaction_remove_ref

test/test_transaction.py:106–122  ·  view source on GitHub ↗

Test removing a reference in a transaction.

(testrepo: Repository)

Source from the content-addressed store, hash-verified

104
105
106def test_transaction_remove_ref(testrepo: Repository) -> None:
107 """Test removing a reference in a transaction."""
108 # Create a test ref
109 test_ref_name = 'refs/heads/test-transaction-delete'
110 target = Oid(hex='5ebeeebb320790caf276b9fc8b24546d63316533')
111 testrepo.create_reference(test_ref_name, target)
112
113 # Verify it exists
114 assert test_ref_name in testrepo.references
115
116 # Remove it in a transaction
117 with testrepo.transaction() as txn:
118 txn.lock_ref(test_ref_name)
119 txn.remove(test_ref_name)
120
121 # Verify it's gone
122 assert test_ref_name not in testrepo.references
123
124
125def test_transaction_error_without_lock(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 4

create_referenceMethod · 0.80
transactionMethod · 0.80
lock_refMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…