Test removing a reference in a transaction.
(testrepo: Repository)
| 104 | |
| 105 | |
| 106 | def 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 | |
| 125 | def test_transaction_error_without_lock(testrepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…