~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
40
40
 
41
41
# Files which are listed here will be skipped when testing for Copyright (or
42
42
# GPL) statements.
43
 
COPYRIGHT_EXCEPTIONS = [
44
 
    'bzrlib/_bencode_py.py',
45
 
    'bzrlib/doc_generate/conf.py',
46
 
    'bzrlib/lsprof.py',
47
 
    ]
 
43
COPYRIGHT_EXCEPTIONS = ['bzrlib/lsprof.py', 'bzrlib/_bencode_py.py',
 
44
    'bzrlib/doc_generate/sphinx_conf.py']
48
45
 
49
 
LICENSE_EXCEPTIONS = [
50
 
    'bzrlib/_bencode_py.py',
51
 
    'bzrlib/doc_generate/conf.py',
52
 
    'bzrlib/lsprof.py',
53
 
    ]
 
46
LICENSE_EXCEPTIONS = ['bzrlib/lsprof.py', 'bzrlib/_bencode_py.py',
 
47
    'bzrlib/doc_generate/sphinx_conf.py']
54
48
# Technically, 'bzrlib/lsprof.py' should be 'bzrlib/util/lsprof.py',
55
49
# (we do not check bzrlib/util/, since that is code bundled from elsewhere)
56
50
# but for compatibility with previous releases, we don't want to move it.
388
382
        """
389
383
        both_exc_and_no_exc = []
390
384
        missing_except = []
391
 
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?'
392
 
                              r'(api\s+)?class (\w+).*:', re.MULTILINE)
393
 
        extern_class_re = re.compile(r'## extern cdef class (\w+)',
394
 
                                     re.MULTILINE)
 
385
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?(api\s+)?class (\w+).*:',
 
386
                              re.MULTILINE)
395
387
        except_re = re.compile(r'cdef\s+' # start with cdef
396
388
                               r'([\w *]*?)\s*' # this is the return signature
397
389
                               r'(\w+)\s*\(' # the function name
402
394
        for fname, text in self.get_source_file_contents(
403
395
                extensions=('.pyx',)):
404
396
            known_classes = set([m[-1] for m in class_re.findall(text)])
405
 
            known_classes.update(extern_class_re.findall(text))
406
397
            cdefs = except_re.findall(text)
407
398
            for sig, func, exc_clause, no_exc_comment in cdefs:
408
399
                if sig.startswith('api '):