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
