/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_repository/test_signatures.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    tests,
23
23
    urlutils,
24
24
    )
25
 
 
 
25
from breezy.repository import WriteGroup
26
26
from breezy.bzr.testament import Testament
27
27
from breezy.tests import per_repository
28
28
 
58
58
    def test_store_signature(self):
59
59
        wt = self.make_branch_and_tree('.')
60
60
        branch = wt.branch
61
 
        branch.lock_write()
62
 
        try:
63
 
            branch.repository.start_write_group()
 
61
        with branch.lock_write(), WriteGroup(branch.repository):
64
62
            try:
65
63
                branch.repository.store_revision_signature(
66
64
                    gpg.LoopbackGPGStrategy(None), b'FOO', b'A')
67
65
            except errors.NoSuchRevision:
68
 
                branch.repository.abort_write_group()
69
66
                raise tests.TestNotApplicable(
70
67
                    "repository does not support signing non-present"
71
68
                    "revisions")
72
 
            except:
73
 
                branch.repository.abort_write_group()
74
 
                raise
75
 
            else:
76
 
                branch.repository.commit_write_group()
77
 
        finally:
78
 
            branch.unlock()
79
69
        # A signature without a revision should not be accessible.
80
70
        self.assertRaises(errors.NoSuchRevision,
81
71
                          branch.repository.has_signature_for_revision_id,