/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/test_source.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:26:22 UTC
  • mfrom: (7167.1.4 run-flake8)
  • Revision ID: breezy.the.bot@gmail.com-20181116182622-qw3gan3hz78a2imw
Add a flake8 test.

Merged from https://code.launchpad.net/~jelmer/brz/run-flake8/+merge/358902

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    )
32
32
import breezy.branch
33
33
from breezy.tests import (
 
34
    features,
34
35
    TestCase,
35
36
    TestSkipped,
36
37
    )
323
324
        if problems:
324
325
            self.fail('\n\n'.join(problems))
325
326
 
 
327
    def test_flake8(self):
 
328
        # Disable lazy_regex, since flake8 uses sre_compile which can't handle
 
329
        # lazy_regex compile objects.
 
330
        from .. import lazy_regex
 
331
        lazy_regex.reset_compile()
 
332
        self.addCleanup(lazy_regex.install_lazy_compile)
 
333
        self.requireFeature(features.flake8)
 
334
        # Older versions of flake8 don't support the 'paths'
 
335
        # variable
 
336
        new_path = list(sys.path)
 
337
        new_path.insert(
 
338
            0, os.path.join(os.path.dirname(__file__), '..', '..', 'tools'))
 
339
        self.overrideAttr(sys, 'path', new_path)
 
340
        from flake8.api import legacy as flake8
 
341
        style_guide = flake8.get_style_guide(config=u'setup.cfg', jobs="1")
 
342
        report = style_guide.check_files(list(self.get_source_files()))
 
343
        self.assertEqual([], report.get_statistics(''))
 
344
 
326
345
    def test_no_asserts(self):
327
346
        """bzr shouldn't use the 'assert' statement."""
328
347
        # assert causes too much variation between -O and not, and tends to