/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: 2018-11-16 16:20:27 UTC
  • mto: This revision was merged to the branch mainline in revision 7174.
  • Revision ID: jelmer@jelmer.uk-20181116162027-6v6i0kpyfi54blso
Use addCleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
        # lazy_regex compile objects.
330
330
        from .. import lazy_regex
331
331
        lazy_regex.reset_compile()
332
 
        try:
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
 
        finally:
345
 
            lazy_regex.install_lazy_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(''))
346
344
 
347
345
    def test_no_asserts(self):
348
346
        """bzr shouldn't use the 'assert' statement."""