/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: 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:
332
332
        new_path.insert(
333
333
            0, os.path.join(os.path.dirname(__file__), '..', '..', 'tools'))
334
334
        self.overrideAttr(sys, 'path', new_path)
335
 
        from flake8.api import legacy as flake8
336
 
        style_guide = flake8.get_style_guide(config=u'setup.cfg', jobs="1")
337
 
        report = style_guide.check_files(list(self.get_source_files()))
338
 
        self.assertEqual([], report.get_statistics(''))
 
335
        from flake8.main.application import Application
 
336
        from flake8.formatting.base import BaseFormatter
 
337
        app = Application()
 
338
        app.config = u'setup.cfg'
 
339
        app.jobs = 1
 
340
 
 
341
        class Formatter(BaseFormatter):
 
342
 
 
343
            def __init__(self):
 
344
                self.errors = []
 
345
 
 
346
            def start(self):
 
347
                pass
 
348
 
 
349
            def stop(self):
 
350
                app.file_checker_manager.report()
 
351
 
 
352
            def handle(self, error):
 
353
                self.errors.append(error)
 
354
 
 
355
        app.formatter = Formatter()
 
356
        app.initialize([])
 
357
        app.run_checks()
 
358
        app.report()
 
359
        self.assertEqual(app.formatter.errors, [])
339
360
 
340
361
    def test_no_asserts(self):
341
362
        """bzr shouldn't use the 'assert' statement."""