tempest/kong/issues.py
Hengqing Hu 9bf93bace2 Remove trailing whitespaces in regular file
Change-Id: I46306a96062ccd751e65351a0bf3e5951ae15905
2012-03-03 12:21:55 +08:00

26 lines
750 B
Python

import re
class KnownIssuesFinder(object):
def __init__(self):
self.count = 0
self._pattern = re.compile('# *KNOWN-ISSUE')
def find_known_issues(self, package):
for file in self._find_test_module_files(package):
self._count_known_issues(file)
def _find_test_module_files(self, package):
for name in dir(package):
if name.startswith('test'):
module = getattr(package, name)
yield module.__file__
def _count_known_issues(self, file):
if file.endswith('.pyc') or file.endswith('.pyo'):
file = file[0:-1]
for line in open(file):
if self._pattern.search(line) is not None:
self.count += 1