~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_source.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

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
359
359
                    return True
360
360
            return False
361
361
        badfiles = []
362
 
        assert_re = re.compile(r'\bassert\b')
363
362
        for fname, text in self.get_source_file_contents():
364
363
            if not self.is_our_code(fname):
365
364
                continue
366
 
            if not assert_re.search(text):
367
 
                continue
368
 
            ast = parser.ast2tuple(parser.suite(text))
 
365
            ast = parser.ast2tuple(parser.suite(''.join(text)))
369
366
            if search(ast):
370
367
                badfiles.append(fname)
371
368
        if badfiles:
382
379
        """
383
380
        both_exc_and_no_exc = []
384
381
        missing_except = []
385
 
        class_re = re.compile(r'^(cdef\s+)?(public\s+)?(api\s+)?class (\w+).*:',
386
 
                              re.MULTILINE)
387
 
        except_re = re.compile(r'cdef\s+' # start with cdef
 
382
        class_re = re.compile(r'^(cdef\s+)?class (\w+).*:', re.MULTILINE)
 
383
        except_re = re.compile(r'cdef\s*' # start with cdef
388
384
                               r'([\w *]*?)\s*' # this is the return signature
389
385
                               r'(\w+)\s*\(' # the function name
390
386
                               r'[^)]*\)\s*' # parameters
393
389
                              )
394
390
        for fname, text in self.get_source_file_contents(
395
391
                extensions=('.pyx',)):
396
 
            known_classes = set([m[-1] for m in class_re.findall(text)])
 
392
            known_classes = set([m[1] for m in class_re.findall(text)])
397
393
            cdefs = except_re.findall(text)
398
394
            for sig, func, exc_clause, no_exc_comment in cdefs:
399
 
                if sig.startswith('api '):
400
 
                    sig = sig[4:]
401
395
                if not sig or sig in known_classes:
402
396
                    sig = 'object'
403
 
                if 'nogil' in exc_clause:
404
 
                    exc_clause = exc_clause.replace('nogil', '').strip()
405
397
                if exc_clause and no_exc_comment:
406
398
                    both_exc_and_no_exc.append((fname, func))
407
399
                if sig != 'object' and not (exc_clause or no_exc_comment):