~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-30 22:40:42 UTC
  • mfrom: (4323 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4324.
  • Revision ID: tanner@real-time.com-20090430224042-53v45axtue5bw45l
Merge 1.14.1 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    )
36
36
import bzrlib.branch
37
37
from bzrlib.tests import (
38
 
    KnownFailure,
39
38
    TestCase,
40
39
    TestSkipped,
41
40
    )
284
283
    def test_coding_style(self):
285
284
        """Check if bazaar code conforms to some coding style conventions.
286
285
 
287
 
        Currently we check for:
 
286
        Currently we assert that the following is not present:
288
287
         * any tab characters
289
 
         * trailing white space
290
288
         * non-unix newlines
291
289
         * no newline at end of files
 
290
 
 
291
        Print how many files have
 
292
         * trailing white space
292
293
         * lines longer than 79 chars
293
 
           (only print how many files and lines are in violation)
294
294
        """
295
295
        tabs = {}
296
296
        trailing_ws = {}
321
321
                'Tab characters were found in the following source files.'
322
322
                '\nThey should either be replaced by "\\t" or by spaces:'))
323
323
        if trailing_ws:
324
 
            problems.append(self._format_message(trailing_ws,
325
 
                'Trailing white space was found in the following source files:'
326
 
                ))
 
324
            print ("There are %i lines with trailing white space in %i files."
 
325
                % (sum([len(lines) for f, lines in trailing_ws.items()]),
 
326
                    len(trailing_ws)))
327
327
        if illegal_newlines:
328
328
            problems.append(self._format_message(illegal_newlines,
329
329
                'Non-unix newlines were found in the following source files:'))
338
338
               '\n\n    %s'
339
339
               % ('\n    '.join(no_newline_at_eof)))
340
340
        if problems:
341
 
            raise KnownFailure("test_coding_style has failed")
342
341
            self.fail('\n\n'.join(problems))
343
342
 
344
343
    def test_no_asserts(self):