~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_sign_my_commits.py

Merge cleanup into description

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
 
22
 
import bzrlib.gpg
 
22
from bzrlib import (
 
23
    gpg,
 
24
    tests,
 
25
    )
23
26
from bzrlib.testament import Testament
24
 
from bzrlib.tests import TestCaseWithTransport
25
27
from bzrlib.workingtree import WorkingTree
26
28
 
27
29
 
28
 
class SignMyCommits(TestCaseWithTransport):
 
30
class SignMyCommits(tests.TestCaseWithTransport):
29
31
 
30
32
    def monkey_patch_gpg(self):
31
33
        """Monkey patch the gpg signing strategy to be a loopback.
33
35
        This also registers the cleanup, so that we will revert to
34
36
        the original gpg strategy when done.
35
37
        """
36
 
        self._oldstrategy = bzrlib.gpg.GPGStrategy
37
 
 
38
38
        # monkey patch gpg signing mechanism
39
 
        bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
40
 
 
41
 
        self.addCleanup(self._fix_gpg_strategy)
42
 
 
43
 
    def _fix_gpg_strategy(self):
44
 
        bzrlib.gpg.GPGStrategy = self._oldstrategy
 
39
        self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
45
40
 
46
41
    def setup_tree(self, location='.'):
47
42
        wt = self.make_branch_and_tree(location)