Test basic transaction with context manager.
(testrepo: Repository)
| 32 | |
| 33 | |
| 34 | def test_transaction_context_manager(testrepo: Repository) -> None: |
| 35 | """Test basic transaction with context manager.""" |
| 36 | master_ref = testrepo.lookup_reference('refs/heads/master') |
| 37 | assert str(master_ref.target) == '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98' |
| 38 | |
| 39 | # Create a transaction and update a ref |
| 40 | new_target = Oid(hex='5ebeeebb320790caf276b9fc8b24546d63316533') |
| 41 | |
| 42 | with testrepo.transaction() as txn: |
| 43 | txn.lock_ref('refs/heads/master') |
| 44 | txn.set_target('refs/heads/master', new_target, message='Test update') |
| 45 | |
| 46 | # Verify the update was applied |
| 47 | master_ref = testrepo.lookup_reference('refs/heads/master') |
| 48 | assert master_ref.target == new_target |
| 49 | |
| 50 | |
| 51 | def test_transaction_rollback_on_exception(testrepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…