/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-02-18 01:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7493.
  • Revision ID: jelmer@jelmer.uk-20200218015745-q2ss9tsk74h4nh61
drop use of future.

Show diffs side-by-side

added added

removed removed

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