def test_grep(self):
        regexp = re.compile('def ([a-zA-Z0-9_]*)(\(.*?\):)')

        registry = getUtility(IFileRegistry)
        matches = registry.grep(regexp, extensions=['py'])

        self.assertEqual(len(matches), 1)
        match = matches[0]

        path = relative_path(registry.get_basedir(), match.get('path'))
        self.assertEqual(path, 'my/package/eventhandlers.py')

        self.assertEqual(match.get('groups'), ('object_removed', '(obj, event):'))
def make_paths_relative(result):
    basedir = getUtility(IFileRegistry).get_basedir()

    for path, dottedname in result:
        path = relative_path(basedir, path)
        yield path, dottedname