/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-08-10 15:00:17 UTC
  • mfrom: (7490.40.99 work)
  • mto: This revision was merged to the branch mainline in revision 7521.
  • Revision ID: jelmer@jelmer.uk-20200810150017-vs7xnrd1vat4iktg
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))