/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: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
448
448
            error_msg.extend(('', ''))
449
449
        if error_msg:
450
450
            self.fail('\n'.join(error_msg))
 
451
 
 
452
    def test_feature_absolute_import(self):
 
453
        """Using absolute imports means avoiding unnecesary stat and
 
454
        open calls.
 
455
 
 
456
        Make sure that all non-test files have absolute imports enabled.
 
457
        """
 
458
        missing_absolute_import = []
 
459
        for fname, text in self.get_source_file_contents(
 
460
                extensions=('.py', '.pyx')):
 
461
            if "/tests/" in fname or "test_" in fname:
 
462
                # We don't really care about tests
 
463
                continue
 
464
            if "from __future__ import absolute_import" not in text:
 
465
                missing_absolute_import.append(fname)
 
466
 
 
467
        if missing_absolute_import:
 
468
            self.fail(
 
469
                'The following files do not have absolute_import enabled:\n'
 
470
                '\n' + '\n'.join(missing_absolute_import))