~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: John Arbash Meinel
  • Date: 2006-12-01 19:41:16 UTC
  • mfrom: (2158 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2159.
  • Revision ID: john@arbash-meinel.com-20061201194116-nvn5qhfxux5284jc
[merge] bzr.dev 2158

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
114
114
        yield bzr_path
115
115
 
116
116
        for root, dirs, files in os.walk(bzrlib_dir):
 
117
            for d in dirs:
 
118
                if d.endswith('.tmp'):
 
119
                    dirs.remove(d)
117
120
            for f in files:
118
121
                if not f.endswith('.py'):
119
122
                    continue
154
157
 
155
158
        return False
156
159
 
 
160
    def test_tmpdir_not_in_source_files(self):
 
161
        """When scanning for source files, we don't descend test tempdirs"""
 
162
        for filename in self.get_source_files():
 
163
            if re.search(r'test....\.tmp', filename):
 
164
                self.fail("get_source_file() returned filename %r "
 
165
                          "from within a temporary directory"
 
166
                          % filename)
 
167
 
157
168
    def test_copyright(self):
158
169
        """Test that all .py files have a valid copyright statement"""
159
170
        # These are files which contain a different copyright statement
241
252
                help_text.append((' '*4) + fname)
242
253
 
243
254
            self.fail('\n'.join(help_text))
 
255
 
 
256
    def test_no_tabs(self):
 
257
        """bzrlib source files should not contain any tab characters."""
 
258
        incorrect = []
 
259
 
 
260
        for fname, text in self.get_source_file_contents():
 
261
            if '\t' in text:
 
262
                incorrect.append(fname)
 
263
 
 
264
        if incorrect:
 
265
            self.fail('Tab characters were found in the following source files.'
 
266
              '\nThey should either be replaced by "\\t" or by spaces:'
 
267
              '\n\n    %s'
 
268
              % ('\n    '.join(incorrect)))