~dobey/tarmac/plugins-tests

« back to all changes in this revision

Viewing changes to tarmac/plugins/command.py

  • Committer: Tarmac
  • Author(s): Gavin Panella
  • Date: 2010-09-02 20:45:59 UTC
  • mfrom: (345.2.3 lint-fixes)
  • Revision ID: paul@eventuallyanyway.com-20100902204559-pp01ph3bcli0hdnk
Fix all pyflakes and pep8 warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
'''Tarmac plugin for running tests pre-commit.'''
 
18
 
 
19
# Head off lint warnings.
 
20
errors = None
 
21
os = None
 
22
subprocess = None
 
23
 
18
24
from bzrlib.lazy_import import lazy_import
19
25
lazy_import(globals(), '''
20
26
    import os
21
27
    import subprocess
22
28
 
23
 
    from bzrlib.errors import TipChangeRejected
 
29
    from bzrlib import errors
24
30
    ''')
25
31
 
26
32
from tarmac.hooks import tarmac_hooks
27
33
from tarmac.plugins import TarmacPlugin
28
34
 
 
35
 
29
36
class Command(TarmacPlugin):
30
37
    '''Tarmac plugin for running a test command.
31
38
 
78
85
        comment = (u'The attempt to merge %(source)s into %(target)s failed.' +
79
86
                   u'Below is the output from the failed tests.\n\n' +
80
87
                   u'%(output)s') % {
81
 
            'source' : self.proposal.source_branch.display_name,
82
 
            'target' : self.proposal.target_branch.display_name,
83
 
            'output' : u'\n'.join([stdout_value, stderr_value]),
 
88
            'source': self.proposal.source_branch.display_name,
 
89
            'target': self.proposal.target_branch.display_name,
 
90
            'output': u'\n'.join([stdout_value, stderr_value]),
84
91
            }
85
 
        raise TipChangeRejected(comment)
 
92
        raise errors.TipChangeRejected(comment)
86
93
 
87
94
 
88
95
tarmac_hooks['tarmac_pre_commit'].hook(Command(), 'Command plugin')