~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: Vincent Ladeuil
  • Date: 2016-01-21 11:42:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6610.
  • Revision ID: v.ladeuil+lp@free.fr-20160121114223-ngcvndi02ydiqs5z
Allow hyphens in option names to unbreak compatibility.

Show diffs side-by-side

added added

removed removed

Lines of Context:
416
416
            error_msg.extend(('', ''))
417
417
        if error_msg:
418
418
            self.fail('\n'.join(error_msg))
 
419
 
 
420
    def test_feature_absolute_import(self):
 
421
        """Using absolute imports means avoiding unnecesary stat and
 
422
        open calls.
 
423
 
 
424
        Make sure that all non-test files have absolute imports enabled.
 
425
        """
 
426
        missing_absolute_import = []
 
427
        for fname, text in self.get_source_file_contents(
 
428
                extensions=('.py', )):
 
429
            if "/tests/" in fname or "test_" in fname:
 
430
                # We don't really care about tests
 
431
                continue
 
432
            if not "from __future__ import absolute_import" in text:
 
433
                missing_absolute_import.append(fname)
 
434
 
 
435
        if missing_absolute_import:
 
436
            self.fail(
 
437
                'The following files do not have absolute_import enabled:\n'
 
438
                '\n' + '\n'.join(missing_absolute_import))