~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: 2010-08-24 19:21:32 UTC
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100824192132-2ktt5adkbk5bk1ct
Handle test_source and extensions. Also define an 'extern' protocol, to allow
the test suite to recognize that returning an object of that type is a Python object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
388
388
        """
389
389
        both_exc_and_no_exc = []
390
390
        missing_except = []
391
 
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?(api\s+)?class (\w+).*:',
392
 
                              re.MULTILINE)
 
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)
393
395
        except_re = re.compile(r'cdef\s+' # start with cdef
394
396
                               r'([\w *]*?)\s*' # this is the return signature
395
397
                               r'(\w+)\s*\(' # the function name
400
402
        for fname, text in self.get_source_file_contents(
401
403
                extensions=('.pyx',)):
402
404
            known_classes = set([m[-1] for m in class_re.findall(text)])
 
405
            known_classes.update(extern_class_re.findall(text))
403
406
            cdefs = except_re.findall(text)
404
407
            for sig, func, exc_clause, no_exc_comment in cdefs:
405
408
                if sig.startswith('api '):